Registration for local notification returns UIUserNotificationTypeNone after user selects "Allow" on iOS9
This worked in iOS 8 and earlier, so it could be a bug in the iOS 9 beta - or it might be a changed behavior.
After asking the user for permission to send local notifications -
NSSet *categories = ...;
UIUserNotificationType notificationTypes = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
and the user selects "Allow" is application:didRegisterUserNotificationSettings:
called with [notificationSettings types] == UIUserNotificationTypeNone
.
However, the next time registerUserNotificationSettings
it starts it will be called with the correct permission types.
Apple's link does not say anything to indicate that this is intended, so this could be a bug.
Does anyone know what the problem is or how to get around it?
source to share
Just discovered that Apple changed their method didRegisterUserNotificationSettings
Of
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
To
- (void)application:(UIApplication * nonnull)application didRegisterUserNotificationSettings:(UIUserNotificationSettings * nonnull)notificationSettings
I don't know if this will solve the problem, but you can try.
source to share