iPhone Mobile Safari File System Access

2020-04-12 00:45发布

问题:

Is it possible to write to a file in a native iPhone application and have a Safari browser read from that file after having the browser opened from the native app?

Alternatively (and this would be great!), would it be possible to launch a mobile Safari webapp from a native iPhone app, and have that application access the OS 3.0 External Accessory Framework? My assumption is no...

Basically, I have a functioning iPhone app that wraps a simple mobile Safari webapp, but I'd like to utilize the external accessory framework once I have launched the Safari webapp from the iPhone app...

回答1:

There are 2 different interpretations. If you want to launch MobileSafari from your app, then the answers will be no since MobileSafari and your app are isolated by sandboxes. But you may include the detail in the URL like

  • http://example.com?info=SXMgaXQgcG9zc2libGUgdG8gd3JpdGUgdG8gYSBma…

But you can embed a UIWebView in your app, then the answers will be yes (to the UIWebView), since you may communicate with the web view with any ObjC code.



回答2:

You can use the phonegap framework : it provide a project template and libraries to access native function in javascript (like writing/reading a file).

Consider also the localstorage and the SQLLite DB...