捕捉答案“应用程序想发送推送通知”警报

第一次在你的UIApplication对象上调用registerForRemoteNotificationTypes:a UIAlertViewpopup“[app]想要发送推送通知”。

有没有什么办法知道什么时候在这个AlertView点击“OK”或“Do not allow”?

当前application:didRegisterForRemoteNotificationsWithDeviceToken:在我的AppDelegate上调用,即使在用户做出决定之前。

我问的原因是因为在第一次启动时,我想推送一个ViewControllerNotification选项,但只有当用户表示他们想要接收通知。

你可以使用UIApplication下一个方法:

返回应用程序接受的通知的types。

 - (UIRemoteNotificationType)enabledRemoteNotificationTypes 

例如,

 UIRemoteNotificationType status = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; if (status == UIRemoteNotificationTypeNone) { NSLog(@"user is not subscribed to receive push notifications"); }