简体   繁体   中英

Phonegap + iOS + Parse Push Notification

I am developing Cordova based app for iOS and android I have successfully implemented Parse for Android. I have a HandleGlobalPush in my index.html which i call from CordovaActivity.java when Parse notification arrives and users taps on it. I handle my view navigation in HandleGlobalPush which redirects user to specific screen/view based on AlertType data received in notification Working fine without any issue.

Yesterday i started for iOS for doing the same This is what i implemented in AppDelegate.m

 -(void) application :(UIApplication *)application
 didReceiveRemoteNotification:(NSDictionary *)userInfo
 {
     // Process the remote notification
     [PFPush handlePush:userInfo];

     // Clear notification badge
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    [[UIApplication sharedApplication] cancelAllLocalNotifications];


     //here data will be json and converted to string in future

     NSString *jsCallBack = [NSString stringWithFormat:@"HandleGlobalPush('data');"];
     //[self.viewController.loadFromString("javascript:" + jsCallBack);
     [viewController.webView stringByEvaluatingJavaScriptFromString:jsCallBack];

}

I can see everything working i can reach till viewController.webView i can see the jsCallBack generated as well. I also see the data received in Push But it is not calling HandleGlobalPush from where i will be doing to view navigation and UI changes based on data..

@Sandy,
I understand what you are doing - but not why. Parse has just released new SDKs for iOS and Android. And in any case, there are already Push Plugin for Parse. Are you trying to build a new Plugin? Is so, there are already instructs for that, and you are off base.

Phonegap FAQ - see last question

Introducing Parse Push for OS X
http://blog.parse.com/announcements/introducing-parse-push-for-os-x/

Google: phonegap push plugin parse

Phonegap Parse Plugin

In addition, if you are writing Java, that defeats the entire purpose of Phonegap, unless you are writing a plugin.

Google: phonegap how to write a plugin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM