Advertisement
anivaros

Untitled

Oct 25th, 2019
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)webView:(WKWebView *)webView startURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask {
  2.     NSLog(@"%@", urlSchemeTask.request.URL);
  3.     __auto_type url = [self changeURLScheme:@"file" forURL:urlSchemeTask.request.URL];
  4.     __auto_type data = [NSData dataWithContentsOfURL:url];
  5.     [urlSchemeTask didReceiveResponse:[[NSURLResponse alloc] initWithURL:urlSchemeTask.request.URL MIMEType:FileMIMEType(url.absoluteString.lastPathComponent) expectedContentLength:data.length textEncodingName:nil]];
  6.     [urlSchemeTask didReceiveData:data];
  7.     [urlSchemeTask didFinish];
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement