如果点击“不允许",回调方法是什么?在推送通知弹出窗口中? [英] What is the Callback Method if You Click "Don't Allow" in Push Notification Popup?
问题描述
全新安装应用时会出现一个推送通知弹出窗口.有两个选择,确定和不允许(如果我没记错的话.)
There's a push notification popup that appears on fresh install of app. There are two choices, OK and Don't Allow (if i remember it correctly.)
我想知道点击不允许"时的回调方法是什么.问题是,我实现了 didFailToRegisterForRemoteNotifications,因为我认为如果我单击不允许",它将直接转到 AppDelegate 中的该方法.但是,没有调用该方法.
I want to know what's the call back method if I click "Don't Allow". The thing is, I implemented didFailToRegisterForRemoteNotifications because I thought that if I click "Don't Allow" it would go straight to that method in AppDelegate. However, the method wasn't called.
我的问题是我需要知道用户点击不允许"时的事件.有没有办法做到这一点?我很感激任何帮助.谢谢.
My problem is I need to know the event when user clicks on "Don't Allow". Is there a way to do this? I'd appreciate any help. Thanks.
推荐答案
这里没有委托回调:用户拒绝推送通知提示的回调方法?
你可以有一个 BOOL 变量在你的 AppDelegate 中检查它,
You can have a BOOL variable to check it in your AppDelegate,
AppDelegate.m
// declare a BOOL
BOOL allow = NO;
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
allow = YES;
[self doWhatever];
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
allow = YES;
[self doWhatever];
}
这篇关于如果点击“不允许",回调方法是什么?在推送通知弹出窗口中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!