Skip to content

Commit

Permalink
Add support for WKWebView.
Browse files Browse the repository at this point in the history
  • Loading branch information
aquach committed Sep 7, 2016
1 parent 3717b95 commit 7c71ef9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ios/screenshot.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ - (void)pluginInitialize
queue:mainQueue
usingBlock:^(NSNotification *note) {
if ([self.webView respondsToSelector:@selector(stringByEvaluatingJavaScriptFromString:)]) {
// UIWebView
[self.webView performSelectorOnMainThread:@selector(stringByEvaluatingJavaScriptFromString:) withObject:@"cordova.fireDocumentEvent('screenshot');" waitUntilDone:NO];
} else if ([self.webView respondsToSelector:@selector(evaluateJavaScript:completionHandler:)]) {
// WKWebView
[self.webView performSelector:@selector(evaluateJavaScript:completionHandler:) withObject:@"cordova.fireDocumentEvent('screenshot');" withObject:nil];
} else {
// cordova lib version is > 4
[self.webView performSelectorOnMainThread:@selector(evaluateJavaScript:completionHandler:) withObject:@"cordova.fireDocumentEvent('screenshot');" waitUntilDone:NO];
Expand All @@ -22,4 +26,4 @@ - (void)pluginInitialize
}
}

@end
@end

0 comments on commit 7c71ef9

Please sign in to comment.