iPhone, if allowed notification, how to know user choose [duplicate]
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.
精彩评论