Is there any way i can open a saved .html file in Documents directory of the application, in Safari. I have a Template.html file that i change depending on user choices and saving it to a temp.html file, how to open it in safari?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
Unfortunately you can't open File-URLs in iOS' Safari-App via [[UIApplication sharedApplication] openURL:] due to sandbox restrictments.
You have 2 options:
a) Upload that file to a server and then open it in the Safari-App with [[UIApplication sharedApplication] openURL:@"http://..."];
b) Embed a Safari-WebView in your app which displays the html-file, like so:
self is a UIViewController here.
EDIT
To add a Share-Button with proper logic, you can put the ViewController, that contains the UIWebView, inside a UINavigationController and add a UIBarButtonItem of type UIBarButtonSystemItemAction to it's NavigationBar. If the BarButtonItem gets tapped, you show a a UIActivityViewController, like so:
For more Infos on using UIActivityViewController, see NSHipster