ios - Pass from UIUserNotificationTypeNone to UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound -
Do you know a way to go from UIUserNotificationTypeNone to UIUserNotificationTypeAlert. UIUserNotificationTypeBadge | UIUserNotificationTypeSound (iOS8)?
UIUserNotificationTypeNone works well to pass, but when the user does not try to switch again to enable ...
This is my code:
// Register for push notifications, if iOS 8 is running ([Responds to app for sesame: @selector (register user notification setting :)) {UIUserNotificationType User Notification Type = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound); UIUserNotificationSettings * settingsAvailable = [UIUserNotificationSettings settingsForTypes: userNotificationTypes categories: nil]; [Application register user notification settings: settings available]; [Register application formation]; } Else {// register for push notifications before iOS 8 [application registerfororemote notification type: (Uyramot notification typepause | URImot notification type alert | URImot notification typeand]]; } After switching to enable the delegate to enable the method of "didRegisterUserNotificationSettings"
// register to receive notice [application registerForreMote notifications ]; NSLog (@ "app is registered for this type:% @", notification settings); Returns:
The app is registered for this type: & lt; UIUserNotificationSettings: 0x15e9e790; Type: (none); & Gt; Thanks in advance
This is because notifications were set Is locked in system settings
Comments
Post a Comment