Skip to content

Commit

Permalink
#60 Add support for Cordova-iOS 4
Browse files Browse the repository at this point in the history
#71 PushPlugin.m error: no visible @interface for 'UIView' declares the selector 'stringByEvaluatingJavaScriptFromString:'
  • Loading branch information
EddyVerbruggen committed Mar 1, 2016
1 parent aeaa19c commit ddaa7a1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,14 @@ - (void)notificationReceived {
[jsonStr appendString:@"}"];

NSString * jsCallBack = [NSString stringWithFormat:@"%@(%@);", self.callback, jsonStr];
[self.webView performSelectorOnMainThread:@selector(stringByEvaluatingJavaScriptFromString:) withObject:jsCallBack waitUntilDone:NO];

if ([self.webView respondsToSelector:@selector(stringByEvaluatingJavaScriptFromString:)]) {
// Cordova-iOS pre-4
[self.webView performSelectorOnMainThread:@selector(stringByEvaluatingJavaScriptFromString:) withObject:jsCallBack waitUntilDone:NO];
} else {
// Cordova-iOS 4+
[self.webView performSelectorOnMainThread:@selector(evaluateJavaScript:completionHandler:) withObject:jsCallBack waitUntilDone:NO];
}

self.notificationMessage = nil;
}
}
Expand Down

1 comment on commit ddaa7a1

@montaserfzy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was fixed my issues

Please sign in to comment.