捕获的答案"应用程序想向您发送推送通知"警报

问题描述:

第一次调用 registerForRemoteNotificationTypes:你的的UIApplication 对象, A UIAlertView中弹出说[应用]想向您发送推送通知。

The first time you call registerForRemoteNotificationTypes: on your UIApplication object, a UIAlertView pops up saying "[app] would like to send you push notifications".

有没有办法知道OK或者不允许在这个被窃听 AlertView

Is there any way to know when "OK" or "Don't allow" is tapped in this AlertView?

目前应用程序:didRegisterForRemoteNotificationsWithDeviceToken:叫上我的的AppDelegate ,用户作出决定之前也

Currently application:didRegisterForRemoteNotificationsWithDeviceToken: is called on my AppDelegate, even before a user makes a decision.

我想问的原因是因为在第一次发射,我想推的ViewController 通知选项,但只有当用户表示,他们希望收到通知。

The reason I ask is because on first launch, I want to push a ViewController with Notification options, but only if the user indicated that they want to receive notifications.

您可以使用下一个方法的UIApplication

You can use next method of UIApplication:

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

- (UIRemoteNotificationType)enabledRemoteNotificationTypes

例如,

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