WKWebView with local file
ios, objective-c, wkwebview
Solution
Try XWebView which has a very tiny embedded http server. It's much smaller than the GCDWebServer. A loadFileURL:allowingReadAccessToURL method is added through extension, so you are not aware of the server.
Problem
I'm testing the WKWebView with local file, which is working in the simulator but it is not working in the device ``` @interface EDPresentationViewController ()<WKNavigationDelegate,WKScriptMessageHandler> @property(nonatomic,strong)WKWebView *webView; @property(nonatomic,strong)EDPresentationController *presentationController; @end @implementation EDPresentationViewController -(void)viewDidLoad { [super viewDidLoad]; self.presentationController = [[EDPresentationController alloc]init]; WKWebViewConfiguration *webConfiguration = [[WKWebViewConfiguration alloc]init]; self.webView = [[WKWebView alloc]initWithFrame:self.view.frame configuration:webConfiguration]; NSURL *presentationFolder = [self.presentationController url]; NSURLRequest *request = [NSURLRequest requestWithURL:presentationFolder]; [self.webView loadRequest:request]; } ``` I grant the url from: ``` NSURL *presentationFolder = [self.presentationController url]; ``` is ok, because I tested the same code with a UIWebview and works! I always get the same error: ``` Could not create a sandbox extension for '/' ``` This wasn't work, I guess it would work in Objective-C as in swift iOS Webkit not working on device, but works on simulator at swift Any idea will be appreciated, thanks Update 2-12-2014 I've discovered this could be a bug in iOS 8.1 and it may be fixed in 8.2 https://devforums.apple.com/thread/247777?start=25&tstart=0 I've tested moving the files to the temporary folder and I didn't get any error but the webView is just empty. I've tested the same code (temporary folder) with a UIWebView and works fine! Also, I've tried this: https://stackoverflow.com/a/26054170/426180 As I could find out, this works because the css and the javascript is embebed in the html.