收到远程通知时,是否有回拨到应用程序委托?

在收到远程通知并且用户采取行动(除关闭/解雇外)后,应用程序委托获取回调:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void(^)(UIBackgroundFetchResult))completionHandler

或者如果应用程序注册了通知操作:

- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler

我的问题是,当收到远程通知时,应用程序是否会收到回调? 这是用户采取任何行动之前。 感谢您的输入。


不,应用程序没有收到任何通知已到达设备的迹象。 当通知实际发送到应用程序时,它只会获得委托调用,如您在问题中的两种情况中所述。


是的,当收到远程通知时,app当然会获得这些代理方法的回调。

 func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    print("DEVICE TOKEN = (deviceToken)")
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
    print(error)
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    print(userInfo)
}
链接地址: http://www.djcxy.com/p/67261.html

上一篇: Is there a callback to the app delegate when a remote notification is received?

下一篇: How to Increment the Push notification Badge iPhone