シミュレーターで動作しているローカル ファイルで WKWebView をテストしていますが、デバイスでは動作していません
@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];
}
私はからのURLを許可します:
NSURL *presentationFolder = [self.presentationController url];
UIWebviewで同じコードをテストして動作するので、大丈夫です!
私はいつも同じエラーが発生します:
Could not create a sandbox extension for '/'
これはうまくいきませんでした.SwiftのようにObjective-Cでもうまくいくと思います.
iOS Webkit はデバイスでは動作しませんが、シミュレーターでは迅速に動作します
どんなアイデアでも感謝します、ありがとう
2014 年 2 月 12 日更新
これは iOS 8.1 のバグである可能性があり、8.2 で修正される可能性があることを発見しました。
https://devforums.apple.com/thread/247777?start=25&tstart=0
ファイルを一時フォルダーに移動することをテストしましたが、エラーは発生しませんでしたが、webView は空です。
UIWebView を使用して同じコード (一時フォルダー) をテストしたところ、正常に動作しました。
また、私はこれを試しました:
https://stackoverflow.com/a/26054170/426180
私が知ることができるように、これは css と javascript が html に埋め込まれているため機能します。