【发布时间】:2015-04-07 10:55:05
【问题描述】:
在前台和后台收到推送通知(静默通知)后,我需要从解析 SDK 获取数据并更新核心数据。如何接收静默推送通知和更新数据(无需单击通知)。我的代码是
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
/*
//notification data format from server
{ "operation": "Update",
“Element”: “1234”,
"action": "db" }
//after receiving update notification ,i should fetch that unique element(1234) data from parse and save data into database.
*/
if ([[userInfo objectForKey:@"operation"] isEqualToString:@"Update"])
{
NSLog(@"update notication called");
//fetching data and updating database using updateDatabase method ,its implemented in some other class.
[database updateDatabase:[userInfo objectForKey:@“Element”]];
}
}
这是静默通知,那么如何在 iOS 中处理静默通知。谢谢
【问题讨论】:
-
那个方法被调用了吗?究竟出了什么问题?
-
在前台它正在调用,在后台它不会...
标签: objective-c background parse-platform push-notification