Skip to content

Commit

Permalink
fix issue with casting types
Browse files Browse the repository at this point in the history
  • Loading branch information
worm-emoji committed Feb 23, 2016
1 parent c535af6 commit eb859b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-detect-screenshot",
"version": "1.0.2",
"version": "1.0.3",
"description": "Detects screenshots on iOS",
"cordova": {
"id": "com.lukemiles.screenshot",
Expand Down
7 changes: 4 additions & 3 deletions src/ios/screenshot.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ - (void)pluginInitialize
object:nil
queue:mainQueue
usingBlock:^(NSNotification *note) {
if ([self.webView isKindOfClass:[UIWebView class]]) {
[(UIWebView*)self.webView stringByEvaluatingJavaScriptFromString:"cordova.fireDocumentEvent('screenshot');"];
if ([self.webView respondsToSelector:@selector(stringByEvaluatingJavaScriptFromString:)]) {
[self.webView performSelectorOnMainThread:@selector(stringByEvaluatingJavaScriptFromString:) withObject:@"cordova.fireDocumentEvent('screenshot');" waitUntilDone:NO];
} else {
[self.webView stringByEvaluatingJavaScriptFromString:@"cordova.fireDocumentEvent('screenshot');"];
// cordova lib version is > 4
[self.webView performSelectorOnMainThread:@selector(evaluateJavaScript:completionHandler:) withObject:@"cordova.fireDocumentEvent('screenshot');" waitUntilDone:NO];
}
}];
}
Expand Down

0 comments on commit eb859b3

Please sign in to comment.