views:

174

answers:

2

Hi! I would need to share data (not necessarily a large amount) between a native iPhone app, and a safari/webkit javascript app... Do you know how this could be done ? I considered sqlite.. But it seems an application can only read/write inside its own bundle (so, not in the webkit databases directory), and the other way, i guess javascript can't access an application directory.. right? Could there be a shared folder that both could access? Not necessarily with sqlite.. I tought also of pasteboards, but they don't seem to be interoperable; and moreover, another app could overwrite the pasteboard in between...

Do you have some other ideas? Thanks in advance!

+1  A: 

You really can't. You can get some data from the JS app to a native app by having the JS app use a custom URL that the native app has registered to invoke, but aside from that you won't have much luck.

You can, of course, share the data through a server somewhere else.

Louis Gerbarg
+1  A: 

The simple answer that you probably already thought of but decided against would be to have the iPhone and web application both download information from an external source (say, the web site that you're hosting the webapp on). Of course this means that your data is external to the phone which is probably why you're asking this question.

Another approach might be to register your native application as a protocol handler. Not sure how that would work as I've not played with that functionality.

Epsilon Prime
Indeed, for this case, the information should be stored locally.. But i'll see what i can do with a network storage.The problem with the protocol handlers is that, in order to communicate, each application must open the other one on exit. If the user just uses the home button, the data won't go anywhere..Anyway, thanks!
Eino Gourdin