iPhone: Sharing data between native and webapp
I would need to share data (not necess开发者_JAVA百科arily 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 thought 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?
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.
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.
精彩评论