appfeel / cordova-push-notifications

Phonegap, Cordova, Intel XDK push notifications support
MIT License
23 stars 25 forks source link

IOS 11 app in foreground crash #7

Open ftKnox opened 6 years ago

ftKnox commented 6 years ago

Notifications work perfectly when the app is in the background. When it is in the foreground it crashes the main thread. I am using the WKwebview plugin. Also note that in a desktop browser, I can call the jsCallBack function without any issues. The below snippet is from PushPlugin.m

Any suggestions?

    [jsonStr appendString:@"}"];
    NSString *jsCallBack = [NSString stringWithFormat:@"%@(%@);", self.callback, jsonStr];

    NSLog(@"CALLBACK %@", jsCallBack); //added just to see what it had for the callback

    //the line below seems to be the offending line
    [self.webView performSelectorOnMainThread:@selector(evaluateJavaScript:completionHandler:) withObject:jsCallBack waitUntilDone:NO];

    self.notificationMessage = nil;
  }
}