Skip to content
pegli edited this page Feb 15, 2012 · 9 revisions

If you are building the module from source, see Building.

Requirements for version 1.1 of the module:

  • The Couchbase Mobile 2.0.0 framework
  • XCode with iPhone OS SDK 5.0 or later

Installing for iOS

  1. Download com.obscure.couchbaseti-iphone-1.1.zip and place it in your Titanium directory (usually ~/Library/Application Support/Titanium).

  2. Follow these instructions to fetch and build the Couchbase Mobile framework for iOS. You may want to set up an admin username and password by adding the following to Resources/default_ios.ini:

     [admins]
     admin = mysecretadminpassword
    
  3. Copy the Couchbase.framework directory to ~/Library/Frameworks. Your app will be linked against this framework at build time.

Installing for Android

  1. Download com.obscure.couchbaseti-android-1.1.zip and place it in your Titanium directory (usually ~/Library/Application Support/Titanium).

  2. If you are using JavaScript views in your project, make sure you run the app on an emulator AVD with a CPU set to armeabi-v7a.

Using the module

To use the couchbase_ti module in your project:

  1. Create a mobile project in Titanium Developer if you have not done so already, then cd into your project directory.

  2. Edit tiapp.xml and add the module declarations as follows:

     <modules>
         <module platform="iphone" version="1.1">com.obscure.CouchbaseTi</module>
         <module platform="android" version="1.1">com.obscure.CouchbaseTi</module>
     </modules>
    
  3. Edit your app.js file and add the following to load and start the Couchbase server:

     var server = require('com.obscure.CouchbaseTi');
     var serverUrl;
    
     server.addEventListener("com.obscure.couchbase_ti.server_started", function(e) {
       serverUrl = e.serverUrl;
     });
     server.startCouchbase();
    
  4. Build and run the app. You should see the following in the log:

     [DEBUG] couchbase started on http://0.0.0.0:64545/
    

    The port number will be different on each run, which is why you have to save the server URL as shown in the preceding step. If Titanium has a problem finding the module, try unzipping the com.obscure.couchbase_ti-*-1.1.zip file.

Clone this wiki locally