launch http://localhost/ instead of file:////www/index.html

428 views
Skip to first unread message

Dave Cottlehuber

unread,
Jun 7, 2011, 10:03:33 AM6/7/11
to phonegap
Hi,

I'm combining phonegap and couchdb on iOS together; both now compile
into a single app and run correctly within it - awesome!

The last stage is to serve the phonegap www/ files out of the local
couchdb via HTTP.

However my reading of the source looks like PG expects its actually a
file not a URL.

How can I pass the couchdb URL (which is on a random port) from ObjC
in an NSURL through to PG, to replace index.hmtl?

Thanks
Dave

Andrew Lunny

unread,
Jun 7, 2011, 12:58:17 PM6/7/11
to phon...@googlegroups.com

I was able to get something going on here a couple of weeks ago:
https://github.com/alunny/ios-couch-phonegap-helloworld

The important bits are defining a couchbaseDidStart method:
https://github.com/alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/Classes/AppDelegate.m#L125-132

and ensuring files serves from localhost can be displayed in your app
(adding to ExternalHosts in phonegap.plist)
https://github.com/alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/PhoneGap.plist#L11-15

Note that mobile Couchbase doesn't include the Futon CMS as part of
its runtime - you'll need to populate a CouchDB so you have something
to display. Here's how I do that:
https://github.com/alunny/ios-couch-phonegap-helloworld/blob/master/helloworld/Classes/AppDelegate.m#L125-132

--
Andrew Lunny
Chief N00b, Nitobi
604 685 9287
blogs.nitobi.com/andrew

Reply all
Reply to author
Forward
0 new messages