在我的应用程序中,我有两种类型的推送通知:带有content-available = 1标志的远程无声通知和通常使用body、badge和其他东西的推送通知。
我还定义了两个委托方法didReceiveRemoteNotification:fetchCompletionHandler和通常的didReceiveRemoteNotification。
但是,当没有content-available标志的推送通知到达时,将调用didReceiveRemoteNotification:fetchCompletionHandler而不是didReceiveRemoteNotification。
怎么解决这个问题?
为什么我不能有两种背景和通常推送的委托方法?
发布于 2014-02-18 12:53:33
iOS 7只调用新的,这是我在我的应用程序中处理它的方式:
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Pass on
[self application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:nil];
}
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// Check if in background
if ([UIApplication sharedApplication].applicationState == UIApplicationStateInactive) {
// User opened the push notification
} else {
// User hasn't opened it, this was a silent update
}
}https://stackoverflow.com/questions/21854350
复制相似问题