我需要在前臺和background.how接收推送通知(無聲通知)後,獲取從核心數據解析SDK和更新數據接收無聲推送通知和更新數據(而對通知點擊)。我的代碼是如何在iOS中
- (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中處理無聲通知。感謝
所以被稱爲該方法?究竟是什麼錯誤? – Wain
在前臺它呼籲,在回地面,它不會... –