The Mobile Couchbase team recently updated the project files and documentation to use MobileCouchbase in your own Apps. You can find the documentation on GitHub.
It took me two days to get the mobile CouchBase running in Xcode 4. So here’s how it works: Important: Do not build or run the project until you have set it up completely!
Get the latest CouchBase repository from https://github.com/couchbaselabs/iOS-Couchbase/ Open Xcode
reate a new project. I used the Split View-based Application. Make sure "Use Core Data" and the initialization of the git repository is checked. Add CFNetwork.framework from the iOS system frameworks and the DatabaseManager.h / DatabaseManager.m to your project in Xcode.
#import "DatabaseManager.h"in your application delegate
Now it get's a bit tricky. You need to get the source code for three libraries. Open your development root folder and type the following commands:
git submodule add firstname.lastname@example.org:TouchCode/TouchJSON.git /Vendor/TouchJSON git submodule add https://github.com/schwa/trundle.git /Vendor/trundle git submodule add https://github.com/TouchCode/TouchFoundation.git /Vendor/TouchFoundation
Open the Finder and locate the "Source" directories for each library and copy the directory into Xcode (ONLY the directory within these library called "Source". You can rename them in the Xcode browser according to their library-names after copying them. Make sure "Copy items into destination group's folder" is checked, and "Create groups for any added folders" is active). Build succeeded. :)
Update I forgot to implement "Couchbase.h", and after putting
#import "Couchbase.h" into the Delegate, the whole thing didn't compile anymore.
The solution is as following:
Create a folder and include your project and the Couchbase-folder. Now create a Workspace and copy your project file (xcodeproj) and the Couchbase.xcodeproj into the workspace in Xcode. Copy the “Couchbase.h” into the Libraries-folder of your project and it should compile. From this point you can start creating your CouchBase app. I had a lot of problems with linker errors complaining about i386 and armv7 missing links etc. Make sure you have the right schema (iPad simulator) and the right valid architectures “armv6 armv7”. Cleaning the project doesn’t always help in this case, so find your “DerivedData”-folder (usually ~/Library/Developer/Xcode/DerivedData) and delete the entire project folder. Then rebuild the project again.