开发者

iPhone, if allowed notification, how to know user choose [duplicate]

开发者 https://www.devze.com 2023-01-24 03:36 出处:网络
This question already has answers here: Determine on iPhone if user has enabled push notifications (19 answers)
This question already has answers here: Determine on iPhone if user has enabled push notifications (19 answers) Closed 8 years ago.

One of our company's iPhone applications uses a push notification the first time the user install the application. The notification pops up a system alertView to ask the user if its allowed receiving pus开发者_如何学Ch notification.

My Question is how to know the user pressed "allowed" or "not allowed".


For remote notifications -- If the registration succeeded, your application delegate will get a callback to this method:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

If it failed, the callback will instead come to this method:

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

Note that there are reasons the registration could fail other than the user pressing the "not allowed" button. See here for more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消