diff --git a/src/ios/screenshot.m b/src/ios/screenshot.m index 2b7774b..f93ded6 100644 --- a/src/ios/screenshot.m +++ b/src/ios/screenshot.m @@ -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]; @@ -22,4 +26,4 @@ - (void)pluginInitialize } } - @end \ No newline at end of file + @end