【发布时间】:2015-09-18 18:35:41
【问题描述】:
我正在为 iOS 和 android 开发基于 Cordova 的应用程序 我已经成功实现了 Parse for Android。 我的 index.html 中有一个 HandleGlobalPush,当 Parse 通知到达并且用户点击它时,我从 CordovaActivity.java 调用它。 我在 HandleGlobalPush 中处理我的视图导航,它根据通知中收到的 AlertType 数据将用户重定向到特定屏幕/视图 工作正常,没有任何问题。
昨天我开始为 iOS 做同样的事情 这是我在 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];
}
在 viewController.webView 我可以看到生成的 jsCallBack 之前,我可以看到我可以到达的所有内容。我还看到在 Push 中收到的数据,但它没有调用 HandleGlobalPush,我将从那里根据数据查看导航和 UI 更改。
【问题讨论】:
标签: ios objective-c cordova parse-platform