捕获对“应用程序想要向您发送推送通知"的回答;警报 [英] Capture answer to "App would like to send you push notifications" alert
问题描述
第一次在 UIApplication
对象上调用 registerForRemoteNotificationTypes:
时,a UIAlertView
会弹出说[app] 想要发送给你推送通知".
The first time you call registerForRemoteNotificationTypes:
on your UIApplication
object, a UIAlertView
pops up saying "[app] would like to send you push notifications".
有什么方法可以知道在此 AlertView
中何时点击了确定"或不允许"?
Is there any way to know when "OK" or "Don't allow" is tapped in this AlertView
?
目前 application:didRegisterForRemoteNotificationsWithDeviceToken:
在我的 AppDelegate
上被调用,甚至在用户做出决定之前.
Currently application:didRegisterForRemoteNotificationsWithDeviceToken:
is called on my AppDelegate
, even before a user makes a decision.
我问的原因是因为在第一次启动时,我想推送一个带有 Notification
选项的 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
的next方法:
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");
}
这篇关于捕获对“应用程序想要向您发送推送通知"的回答;警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!