Skip to content
Paul Mietz Egli edited this page May 17, 2013 · 22 revisions

To learn more about Couchbase Lite, the underlying implementation of this module, see the Couchbase Lite Wiki. See the Building page for information on how to build the module from source.

iOS Usage

TiTouchDB will only run on iOS 5.0 or later. By default, Titanium applications are configured with a minimum required OS version of 4.0. With earlier versions of the Titanium SDK, you could open the generated Xcode project file and change the deployment target version to 5.0, but more recent (2.1.x) versions of the SDK, that file gets overwritten on each build. There is an open bug that promises a fix for this soon. In the meantime, you will need to edit the project file templates in your SDK directory to do the following:

  • change all instances of IPHONEOS_DEPLOYMENT_TARGET = 4.0; to IPHONEOS_DEPLOYMENT_TARGET = 5.0;
  • remove all references to armv6

The file templates are:

iphone/iphone/Titanium.xcodeproj/project.pbxproj
module/iphone/templates/___PROJECTNAME___.xcodeproj/project.pbxproj

IMPORTANT NOTE: obviously, this will affect all the projects you build with the modified SDK. You might consider copying your current SDK file and modifying the copy.

Once you have the minimum SDK set, copy the module ZIP file to either the project root directory (the same directory as tiapp.xml) or your Titanium installation. Build your project to expand the module archive. Once that is done, you can edit tiapp.xml and add the module to the modules section:

<modules>
    <module version="0.9" platform="iphone">com.obscure.titouchdb</module>
</modules>

If you're using Titanium Studio, you can edit tiapp.xml and add the module from the fancy GUI.

Android usage

Copy the module ZIP file to either the project root directory (the same directory as tiapp.xml) or your Titanium installation. Build your project to expand the module archive. Edit tiapp.xml and add the module to the modules section:

<modules>
    <module version="0.9" platform="android">com.obscure.titouchdb</module>
</modules>

Loading the module

Here's how to load up the module and get a database object:

var dbmgr = require('com.obscure.titouchdb').databaseManager;
var db = dbmgr.databaseNamed('books');

See the API documentation, FAQ and the TouchBooks and TouchBooksAlloy sample apps for more information. There is also a tutorial which explains how the TouchBooksAlloy example app is built here which contains a lot of useful information for integrating TouchDB with the Alloy framework.

Clone this wiki locally