Dreaming of a reference iOS and Android Implementation with PhoneGap

466 views
Skip to first unread message

xmann

unread,
May 29, 2011, 4:40:27 AM5/29/11
to mobile-c...@googlegroups.com
Hi everyone,

I've been spending the last two weeks experimenting with CouchDB and thinking about how to get a project up and running in PhoneGap to get the advantages of CouchDB replication and map/reduce across mobile devices. I've been using Rhodes and Rhosync in the past which was really easy to get up and running on iPhone, iPad and Android; whereas, trying out Mobile Couchbase and PhoneGap seems to require much more effort to get up and running (I realize Couchbase-iOS is still in beta and not everyone uses PhoneGap so flexibility is required!). 

This got me thinking on whether I'm the only one who would love to see a reference implementation of Couchbase Mobile on iPhone and Android using PhoneGap. Basically, this would be a way to provide best practices or common solutions to common use cases like:

1) How to transparently install (or package) Mobile Couchbase on iOS and Android with your application
2) How to seed a new mobile device installation assuming the mobile device may be offline when first used
3) How to structure a server's databases and documents per user (plus best practices to be ready for future scalability) and setting up multiple mobile devices per user for replication including account creation/login from the mobile device
4) Setting up or generating the PhoneGap projects for iOS and Android with Mobile Couchbase 
5) A sample user-triggered sync (vs continuous) sync from the mobile device

I could imagine this reference implementation could be available from a Github repository, just a blog with instructions, or even some fancy generation scripts (like rake).

I realize that it could be a bit early days for this or that I may be the only one who finds approaching each one of these problems something I'd rather not have to spend too much time thinking about early in a project or prototype. But I'm sure there could be other developers out there considering Couchbase for cross-platform development and probably there are others who don't want to reinvent the wheel but who instead want to quickly jump into their unique application's added value features as soon as possible.

In short, are there other people out there interested in a reference implementation of Mobile Couchbase on iOS and Android with PhoneGap?

XMann

Alexander Gabriel

unread,
May 29, 2011, 5:56:10 AM5/29/11
to mobile-c...@googlegroups.com

Yes, this would be extremely helpful!

Alex

Roger Rohrbach

unread,
May 29, 2011, 8:58:07 AM5/29/11
to Mobile Couchbase
I'm interested in this (except for the PhoneGap part). I might
eventually have something to contribute; I'm working on a project that
may used Couchbase Mobile, in which case, we'll be tackling some of
these tasks.

This is slightly off-topic, but: why are you moving from Rhodes/
RhoSync?

Dave Cottlehuber

unread,
May 29, 2011, 5:18:52 PM5/29/11
to mobile-c...@googlegroups.com

Hi XMann,

Yes indeed. I'm (slowly) hacking away at the Phonegap/iOS combo
https://github.com/dch/couchgap and there are others working on
android too. Hopefully later this week I'll have sorted out passing
the couchbase URL/port combo back into phonegap so it can load that
rather than the current index.html. Suggestions and help welcomed as
I'm more couch than iOS.

Cheers
Dave

Cheers
Dave

xmann

unread,
May 31, 2011, 12:55:41 AM5/31/11
to mobile-c...@googlegroups.com
That would be great! I think it would be perfect to take this from a direction of a real-world application. 

On the Rhodes/RhoSync topic, moving away is more something I've been evaluating than made a concrete decision on yet - a friend pointed out I should consider CouchDB give the reporting requirements of the application so built in map/reduce is really a strong selling point to switch. 

This is a side project I've been working on in my spare time using Backbone.js + JQuery libraries + Brunch and find myself trying to do more in the client Coffeescript avoiding all of the server side Ruby programming in Rhodes because of a poor debugging environment (to be fair: Rhoile are actively working on getting a debugger working in RhoStudio in Eclipse but it is currently Windows only and quite primitive). CouchDB looks like an environment where I can primarily develop and debug on my laptop using small building blocks (views, etc) and then just bring across to the mobile phone - it seems like a more efficient development workflow (that said, given the points above, there is currently a big tradeoff between running a few rake scripts in Rhodes and finding production-ready solutions to these CouchDB basic cross-platform mobile needs).

Additionally, there are licensing fees on RhoSync. That said, it is not completely clear to me on the licensing side of CouchDB and Couchbase mobile...need to investigate further. 

Having a good reference implementation so I know I'm doing thing right and not reinventing the wheel would go a long way to help make this decision!

Roger Rohrbach

unread,
May 31, 2011, 3:09:44 PM5/31/11
to Mobile Couchbase
I asked about Rhodes/RhoSync because I was a little surprised to hear
you say they were "really easy to get up and running." I've not used
Rhodes, but I found setting up RhoSync confusing (it's poorly
documented) and never got as far as ascertaining whether it works. It
doesn't detect conflicting updates, so I ran in the other direction,
and ended up...here! I'm not going to adopt Couchbase solely for its
sync capabilities, but it's been a pleasure to work with and suits my
data model, so it's in the running.

xmann

unread,
Jun 2, 2011, 2:25:03 AM6/2/11
to mobile-c...@googlegroups.com
You're absolutely right...Rhodes and RhoSync are quite different - I use Rhodes all the time which has been a real pleasure (except for the debugging), but I've only done very basic proof-of-concept with RhoSync, but it works for me; however, just like Couchbase, it takes time to understand the limits/constraints, best practices, and whether they fit your application. Although the documentation is very basic with Rhomobile, the good thing that provides is regular screencasts which cover some good topics of using their frameworks and obviously there are shipped apps which already use the technology which adds to my confidence.

Of course, I wouldn't be looking into Couchbase if I didn't see the massive potential of it and believe that it could be better for me, too!

My impression with Couchbase today on mobile devices and espcially for cross-platform mobile development, is that it is right now in the days of the pioneers working on the bleeding edge in the sense that the technology pieces are getting in place, but there are some basic things that are still needed (like the cross-platform reference implementation, more blog articles on how to handle common mobile-related problems, etc) before I can have confidence that I won't discover a better way to do things after reviewing an upcoming blog from the community in a couple of months and throw away my hard work.

In short, like you I'm sold on Couchbase, it has been a pleasure to work with, and it is in the running. I just wonder if I am a little too early - jump in now? or wait for people more experienced and brilliant than me to solve a lot of the basic problems so I can focus on the unique needs of my application when the time is right?

xmann

unread,
Jun 5, 2011, 6:24:47 AM6/5/11
to Mobile Couchbase
Hi Dave,

Thank you very much for sharing this.

I've been able to load my index.html in couchgap, but haven't been
able to take it any further.

I was wondering about two things:

1) Given the currently random URLs related to bug "no method to locate
CouchDB local URL" and your above comment "passing the couchbase URL/
port combo back into phonegap so it can load that rather than the
current index.html", how do you imagine this working? The reason I ask
is that I'm using Backbone.js and couchapp so I'm wondering how to
integrate a changing URL into my client-side javascript code.

2) How do you imagine an application being deployed/integrated into
couchgap? Currently, I have set up a desktop environment using
couchapp and some PhoneGap shims (http://www.phonegap.com/2011/05/18/
debugging-phonegap-javascript/) so I can debug my JavaScript properly.
I needed to use couchapp on my desktop testing environment because I
was running into "Access-Control-Allow-Origin" issues using the
index.html file in chrome. I haven't tested this yet, but will I run
into the same "Access-Control-Allow-Origin" problem if I try to use
mobile couchbase from my index.html file in the PhoneGap www folder?

If so, I noticed in this article (http://arandomurl.com/2011/02/13/
developing-with-couchdb-on-android.html) that you can use "couchapp
push --export > filename.json" to serialize a couchapp so I was
thinking about using this json file to upload my couchapp (maybe using
some version checking) from couchgap. How do you imagine an
application being deployed/integrated into couchgap?

That you for any advice...I'm quite new to web programming and am
learning something new everyday!

Cheers,

XMann

On May 29, 11:18 pm, Dave Cottlehuber <d...@muse.net.nz> wrote:
> Yes indeed. I'm (slowly) hacking away at the Phonegap/iOS combohttps://github.com/dch/couchgap and there are others working on

J. Chris Anderson

unread,
Jun 6, 2011, 12:57:54 AM6/6/11
to mobile-c...@googlegroups.com
I have only done a little Phone Gap work so far, but my guess is that phone gap is normally built to point it's webkit view at a file:// URL. If you are hosting CouchApps in PhoneGap, you'll need a build that points webkit at http://0.0.0.0:MYRANDOMPORT

I think what will happen is PhoneGap will implement the normal Couchbase callbacks, and then give you a phonegap window that is already pointed in the right place.

At least that is what I hope, but I haven't looked closely at any of the PhoneGap tools yet.

Chris

Amos Hayes

unread,
Jun 6, 2011, 10:52:01 AM6/6/11
to mobile-c...@googlegroups.com

Hi Chris. Do you know if someone made has made this happen yet? I saw a couple questions about it and your earlier response, but I don't know what happened after that.

--
Amos

Dave Cottlehuber

unread,
Jun 7, 2011, 10:30:00 AM6/7/11
to mobile-c...@googlegroups.com
On 7 June 2011 02:52, Amos Hayes <aha...@gcrc.carleton.ca> wrote:
>
> Hi Chris. Do you know if someone made has made this happen yet? I saw a couple questions about it and your earlier response, but I don't know what happened after that.
>
> --
> Amos

Hi Amos,

I've been hacking away at this. However in both phonegap and couchbase
the code has changed & now what was quite messy is now an easy matter
of plugging the frameworks together. I'm not sure its even necessary
for my GH repo anymore.

I'm further on than last week but still not quite there - I'm learning
ObjC as I go here. Help welcomed!

________________________________________________________________________________

# Getting started with PhoneGap and Couchbase-iOS

Here's a quick start guide to getting your first PhoneGap app running with its
own local CouchDB included.

Phonegap provides leading-edge integration between smartphone native APIs
industry-standard Javascript. Couchbase provides leading-edge integration
between Apache CouchDB and smartphones such as Android and iOS-based devices.

Huge thanks to Couchbase, PhoneGap and the CouchDB community for enabling this
through open source.

________________________________________________________________________________

# Pre-requisites

## Get Xcode 4

You'll need this to compile Couchbase-iOS from source for your App.

## Get PhoneGap

- Close Xcode
- Download [Phonegap] 0.9.5.1 or get it from the [PhoneGap GitHub repo], and
run the template installer, accepting defaults:

unzip ~/Downloads/phonegap-0.9.5.1.zip
open phonegap-0.9.5.1/iOS/PhoneGapInstaller.pkg

## Couchbase

Marty Schoch's precompiled bundle is now up at [Couchbase Labs] on github!

- Get the Couchbase bits

git clone https://github.com/couchbaselabs/iOS-Couchbase-Templates
cd iOS-Couchbase-Templates/
open CouchbaseTemplates.xcworkspace/

Install the templates:

- Choose scheme `Download Couchbase` and run it - takes a while
- Choose scheme `Install Xcode Project Templates` & run it too
- Confirm couchbase files are now in `~/Library/Developer/Xcode/Templates/`

## Your App

- Create a new Xcode Workspace
- Create a new Xcode Project & select the new PhoneGap template
- Select scheme `iPhone Simulator` and run it once to initialise - it
should start, but the simulator will error _missing file
www/index.html_
- Open the project in Finder and drag the new `www/` folder into your
Supporting Files, add as reference

### Change build target

- Go to project view and select your PhoneGap target
- Select `Build Phases` & open `Link with Binaries`
- Select `+` and add in `libstdc++.dynlib`

### Import the Couchbase bits

- Open in Finder
`~/Library/Developer/Xcode/Templates/Couchbase/Couchbase\
Base.xctemplate`
- Drag `libCouchbase.a` into your project's `Frameworks` folder, add
as reference
- Drag `Couchbase.bundle` into `Supporting Files`, copy (so we can
edit bits of it later)
- Select the project target again, then select `Build Phases` tab
- In bottom right corner of Xcode, choose `Add Build Phase -> Add Copy
Headers -> Add Other`
- Select `Couchbase.h` from
`~/Library/Developer/Xcode/Templates/Couchbase/Couchbase
Base.xctemplate/` and add as reference

### Extend your App Delegate with Couchbase Magic

- In your `.h` file, import the Couchbase header file & protocols:

#import "Couchbase.h"

@property(nonatomic, retain)NSURL *couchbaseURL;
-(void)couchbaseDidStart:(NSURL *)serverURL;
-(NSURL *)getCouchbaseURL;

- In your `.m` file, add the `couchbaseDidStart` delegate callback:

@synthesize couchbaseURL;

-(NSURL *)getCouchbaseURL {
return self.couchbaseURL;
}

- (void)couchbaseDidStart:(NSURL *)serverURL {
self.couchbaseURL = serverURL;
NSLog(@"[INFO] CouchDB is ready at serverURL %@",serverURL);
}


### Get Couchbase to start when PhoneGap starts

- In your `.m` file, at the beginning of `application
didFinishLaunchingWithOptions`, add

[Couchbase startCouchbase:self];

- this should accept optional port/parameter according to
https://github.com/couchbaselabs/iOS-Couchbase/blob/master/Demo/Classes/DemoAppDelegate.m#L45

### Get the Couchbase URL and pass it to PhoneGap [TODO]


> On 2011-06-06, at 12:57 AM, J. Chris Anderson wrote:
>
>> I think what will happen is PhoneGap will implement the normal Couchbase callbacks, and then give you a phonegap window that is already pointed in the right place.
>

This was my intent; however:

- phonegap looks like its expecting to use file:/// all over the
place. this looks fixable but kinda messy; I have asked their list for
some ideas on passing the URL through
- this [1] suggests I should be able to call [[Couchbase
startCouchbase:self] and pass a known port. The source doesn't look
like that's a goer. Is it possible to fix the port?

Chris - any news of a wiki?

A+
Dave
[1]: https://github.com/couchbaselabs/iOS-Couchbase/blob/master/Demo/Classes/DemoAppDelegate.m#L45

Amos Hayes

unread,
Jun 8, 2011, 11:39:20 AM6/8/11
to mobile-c...@googlegroups.com

Thanks so much Dave!

That is a great write up and I will go with it so I'm in sync with what you are doing. I'm new to iOS too. Will the response on the Phonegap list help with that last bit? He does this:

https://github.com/alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/Classes/AppDelegate.m#L125-132

I guess I will have to try building it to see what his demoapp.couch contains. I'm trying to understand what Phonegap needs with file:/// after the initial page load. If an app were to write out an index.html for Phonegap with an immediate redirect, would that break something?

Also, I assume the default of a random port is to avoid collisions between apps on the same device. If it selects a random port that is already in use, will it try again? I'm not sure that selecting a fixed port is wise in the long run.

--
Amos

Dave Cottlehuber

unread,
Jun 8, 2011, 3:31:25 PM6/8/11
to mobile-c...@googlegroups.com
On 9 June 2011 03:39, Amos Hayes <aha...@gcrc.carleton.ca> wrote:
>
> Thanks so much Dave!
>
> That is a great write up and I will go with it so I'm in sync with what you are doing. I'm new to iOS too. Will the response on the Phonegap list help with that last bit? He does this:

Yeah it looks like it nails it, I'll work through rest of it today &
push it all to github. There are a few things I want to change; he
bundles a demoapp.couch in with the project & does the copy with
obj-c. I'd like to have the app start up in futon, and then couchapp
push away.

> https://github.com/alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/Classes/AppDelegate.m#L125-132
>
> I guess I will have to try building it to see what his demoapp.couch contains. I'm trying to understand what Phonegap needs with file:/// after the initial page load. If an app were to write out an index.html for Phonegap with an immediate redirect, would that break something?
>
> Also, I assume the default of a random port is to avoid collisions between apps on the same device. If it selects a random port that is already in use, will it try again? I'm not sure that selecting a fixed port is wise in the long run.

Agreed, but it saves a lot of time for me when fiddling with couchdb
via couchapp & other tools.

A+
Dave

Amos Hayes

unread,
Jun 8, 2011, 4:02:02 PM6/8/11
to mobile-c...@googlegroups.com

Super Dave.

I had some time to try this out. I've included a few fixes/comments to your instructions inline.

--
Amos Hayes
Geomatics and Cartographic Research Centre
Carleton University, Canada
aha...@gcrc.carleton.ca
+1.613.520.2600x8179

On 2011-06-07, at 10:30 AM, Dave Cottlehuber wrote:
>

This scheme didn't exist. I had to add it.


> - Choose scheme `Install Xcode Project Templates` & run it too
> - Confirm couchbase files are now in `~/Library/Developer/Xcode/Templates/`
>
> ## Your App
>
> - Create a new Xcode Workspace
> - Create a new Xcode Project & select the new PhoneGap template
> - Select scheme `iPhone Simulator` and run it once to initialise - it
> should start, but the simulator will error _missing file
> www/index.html_
> - Open the project in Finder and drag the new `www/` folder into your
> Supporting Files, add as reference
>
> ### Change build target
>
> - Go to project view and select your PhoneGap target
> - Select `Build Phases` & open `Link with Binaries`

This should be "Link Binaries with Libraries"

But there are two in the list. The first has 13 frameworks already in there. The second has 0 items. I chose the former.

> - Select `+` and add in `libstdc++.dynlib`

That library shows up three times for me (all together). Does it matter which I pick? I chose the first match.

>
> ### Import the Couchbase bits
>
> - Open in Finder
> `~/Library/Developer/Xcode/Templates/Couchbase/Couchbase\
> Base.xctemplate`
> - Drag `libCouchbase.a` into your project's `Frameworks` folder, add
> as reference
> - Drag `Couchbase.bundle` into `Supporting Files`, copy (so we can
> edit bits of it later)
> - Select the project target again, then select `Build Phases` tab
> - In bottom right corner of Xcode, choose `Add Build Phase -> Add Copy
> Headers -> Add Other`

In bottom right corner of Xcode, choose `Add Build Phase -> Add Copy

Headers'
Then expand that build phase and click "+" in it to "Add Other..."

> - Select `Couchbase.h` from
> `~/Library/Developer/Xcode/Templates/Couchbase/Couchbase
> Base.xctemplate/` and add as reference
>
> ### Extend your App Delegate with Couchbase Magic
>
> - In your `.h` file, import the Couchbase header file & protocols:
>
> #import "Couchbase.h"
>
> @property(nonatomic, retain)NSURL *couchbaseURL;
> -(void)couchbaseDidStart:(NSURL *)serverURL;
> -(NSURL *)getCouchbaseURL;
>
> - In your `.m` file, add the `couchbaseDidStart` delegate callback:
>
> @synthesize couchbaseURL;
>
> -(NSURL *)getCouchbaseURL {
> return self.couchbaseURL;
> }
>
> - (void)couchbaseDidStart:(NSURL *)serverURL {
> self.couchbaseURL = serverURL;
> NSLog(@"[INFO] CouchDB is ready at serverURL %@",serverURL);
> }
>
>
> ### Get Couchbase to start when PhoneGap starts
>
> - In your `.m` file, at the beginning of `application
> didFinishLaunchingWithOptions`, add
>
> [Couchbase startCouchbase:self];


This gives the warning "Sending 'AppDelegate *' to parameter of incompatible type 'id<CouchbaseDelegate>'"

Building and running seems to work although there are some warnings reported:

Nunaliit
/Users/ahayes/Documents/Apps/Nunaliit/Nunaliit/Classes/AppDelegate.m
Class 'AppDelegate' does not implement the 'CouchbaseDelegate' protocol
file://localhost/Users/ahayes/Documents/Apps/Nunaliit/Nunaliit/Classes/AppDelegate.m: warning: Semantic Issue: Sending 'AppDelegate *' to parameter of incompatible type 'id<CouchbaseDelegate>'

Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Nunaliit/Nunaliit-Info.plist'.
Directory not found for option '-L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/gcc/arm-apple-darwin10/4.0.1'
warning: Missing - Add /Users/ahayes/Documents/Apps/Nunaliit/www as a folder reference in your project. Just drag and drop the folder into your project, in Xcode 4.

xmann

unread,
Jun 12, 2011, 9:09:05 AM6/12/11
to Mobile Couchbase
Hi Amos,

Some feedback to the set up problems:

1) For: "Sending 'AppDelegate *' to parameter of incompatible type
'id<CouchbaseDelegate>'"
-> This is because you need to set up your app delegate to also be a
CouchbaseDelegate like this:

@interface AppDelegate : PhoneGapDelegate<CouchbaseDelegate> {

2) For: "Warning: The Copy Bundle Resources build phase contains this
target's Info.plist file 'Nunaliit/Nunaliit-Info.plist'. "
-> You need to go into the "Copy Bundle Resources" and delete your App
plist...Select your project in the left side panel, then select your
TARGET, then choose the "Build Phases" tab, open "Copy Bundle
Resources", select your App plist, press '-' to delete.

3) For: "warning: Missing - Add /Users/ahayes/Documents/Apps/Nunaliit/
www as a folder reference in your project. Just drag and drop the
folder into your project, in Xcode 4."
-> Just follow the instructions in the warning...Drag and drop ;-)

4) For: "Directory not found for option '-L/Developer/Platforms/
iPhoneSimulator.platform/Developer/SDKs/iPhoneSimul ator4.3.sdk/usr/
lib/gcc/arm-apple-darwin10/4.0.1'"
-> I haven't found a solution for this.

Good luck!

XMann
> >        git clonehttps://github.com/couchbaselabs/iOS-Couchbase-Templates
> file://localhost/Users/ahayes/Documents/Apps/Nunaliit/Nunaliit/Classes/AppD elegate.m: warning: Semantic Issue: Sending 'AppDelegate *' to parameter of incompatible type 'id<CouchbaseDelegate>'
>
> Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Nunaliit/Nunaliit-Info.plist'.
> Directory not found for option '-L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimul ator4.3.sdk/usr/lib/gcc/arm-apple-darwin10/4.0.1'
> warning: Missing - Add /Users/ahayes/Documents/Apps/Nunaliit/www as a folder reference in your project. Just drag and drop the folder into your project, in Xcode 4.
>
>
>
>
>
>
>
>
>
> > - this should accept optional port/parameter according to
> >https://github.com/couchbaselabs/iOS-Couchbase/blob/master/Demo/Class...
>
> > ### Get the Couchbase URL and pass it to PhoneGap [TODO]
>
> >> On 2011-06-06, at 12:57 AM, J. Chris Anderson wrote:
>
> >>> I think what will happen is PhoneGap will implement the normal Couchbase callbacks, and then give you a phonegap window that is already pointed in the right place.
>
> > This was my intent; however:
>
> > - phonegap looks like its expecting to use file:/// all over the
> > place. this looks fixable but kinda messy; I have asked their list for
> > some ideas on passing the URL through
> > - this [1] suggests I should be able to call [[Couchbase
> > startCouchbase:self] and pass a known port. The source doesn't look
> > like that's a goer. Is it possible to fix the port?
>
> > Chris - any news of a wiki?
>
> > A+
> > Dave
> > [1]:https://github.com/couchbaselabs/iOS-Couchbase/blob/master/Demo/Class...

xmann

unread,
Jun 12, 2011, 9:27:33 AM6/12/11
to Mobile Couchbase
Hi everyone,

I spent yesterday and a bit of today going through all these great
samples and instructions. Thank you!

Alunny was kind enough to explain what he did (https://github.com/
alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/Classes/
AppDelegate.m#L125-132) and gave me a few pointers - cheers!

Pointer 1) In order to not have your PhoneApp switch to the local
Safari app when you call [webView
stringByEvaluatingJavaScriptFromString:couchappApgeURL], you need to
add localhost to the ExternalHosts key in your PhoneGap.plist:
https://github.com/alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/PhoneGap.plist#L11-15
-> Select your PhoneGap.plist in the "Supporting Files" directory, and
add the following 2 items as separate entries: 127.0.0.1 and 0.0.0.0.


What I've done is started a project to start the path to fulfilling my
dream in this original thread (see the 5 starting this thread):
https://github.com/xmann/phonegap-couchbase-xplatform

Currently, there is a "CouchAppManager" objective-C class which
handles bootstrapping a CouchApp into the iOS local database (since
you can't assume the user to be online when they first run your app).
Take a look at the sample AppDelegate.m couchbaseDidStart method for
how it can be used. It hasn't been fully tested, but it seems to work
(most of the time).


I would love if any of your are now inspired that maybe you can help
help test it, make it work on a physical iOS device, and provide
something similar for an Android version!

Cheers,

Xmann

xmann

unread,
Jun 12, 2011, 12:24:49 PM6/12/11
to Mobile Couchbase
It is working on a physical device. I needed to register for an app
ID: http://developer.apple.com/iphone/manage/overview/index.action

http://wiki.phonegap.com/w/page/39991939/Getting-Started-with-PhoneGap-iOS-using-Xcode-4-(Template-Version)



On Jun 12, 3:27 pm, xmann <xmann.i...@gmail.com> wrote:
> Hi everyone,
>
> I spent yesterday and a bit of today going through all these great
> samples and instructions. Thank you!
>
> Alunny was kind enough to explain what he did (https://github.com/
> alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/Classes/
> AppDelegate.m#L125-132) and gave me a few pointers - cheers!
>
> Pointer 1) In order to not have your PhoneApp switch to the local
> Safari app when you call [webView
> stringByEvaluatingJavaScriptFromString:couchappApgeURL], you need to
> add localhost to the ExternalHosts key in your PhoneGap.plist:https://github.com/alunny/ios-couch-phonegap-helloworld/blob/master/h...

xmann

unread,
Jun 14, 2011, 4:07:31 PM6/14/11
to Mobile Couchbase
Hi everyone,

I've migrated this project to: https://github.com/kmalakoff/phonegap-couchbase-xplatform.

It is much improved as it does not use as much memory and no longer
has a dependency on TouchJSON.

A work colleague helped me set up and write a gem to help the couchapp
extraction process. Just do:

Install:
gem install couchapp-bundler

Usage:
couchapp-bundler [-h <hostname>] [-p <port>] [-d <couchapp>] [-a
<couchapp_doc>] [-o <outfile filename>]

For example:

couchapp-bundler -d mycouchapp -o mycouchapp

Enjoy!

Kevin/XMann

Jonathan Wight

unread,
Jun 14, 2011, 4:28:40 PM6/14/11
to mobile-c...@googlegroups.com
Uhhhh, if you're going to rip huge chunks of TouchFoundation out of the app can you at least put it in a different directory so that folks don't confuse it for the actual TouchFoundation.

Jon.

xmann

unread,
Jun 14, 2011, 5:16:58 PM6/14/11
to Mobile Couchbase
OK. Done.

TouchFoundation -> TouchFoundation_MinimalExtraction and added a
README.

xmann

unread,
Jun 16, 2011, 1:58:56 AM6/16/11
to Mobile Couchbase
Hi everyone,

I've tweaked the libraries and updated the sample doc to demonstrate
loading a couchapp and a document. The idea is that you can not only
load a couchapp resource but also load some initial data for your
couchapp.

Also, I've updated the naming to reflect that the Objective-C library
and gem are more generic for loading documents:

1) CouchMover.h and CouchMover.m: https://github.com/kmalakoff/phonegap-couchbase-xplatform
2) couchpack gem: https://github.com/kmalakoff/couchpack-gem
gem install couchpack

Enjoy,

Xmann
Reply all
Reply to author
Forward
0 new messages