ios - Pass from UIUserNotificationTypeNone to UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound -
do know way pass uiusernotificationtypenone uiusernotificationtypealert | uiusernotificationtypebadge | uiusernotificationtypesound (ios8)?
to pass uiusernotificationtypenone works not when user seek switch 1 time again enable ...
this code:
// register force notifications, if running ios 8 if ([application respondstoselector:@selector(registerusernotificationsettings:)]) { uiusernotificationtype usernotificationtypes = (uiusernotificationtypealert | uiusernotificationtypebadge | uiusernotificationtypesound); uiusernotificationsettings * settingsavailable = [uiusernotificationsettings settingsfortypes:usernotificationtypes categories:nil]; [application registerusernotificationsettings:settingsavailable]; [application registerforremotenotifications]; } else { // register force notifications before ios 8 [application registerforremotenotificationtypes:(uiremotenotificationtypebadge | uiremotenotificationtypealert | uiremotenotificationtypesound)]; }
after switch enable method of delegate "didregisterusernotificationsettings"
// register receive notifications [application registerforremotenotifications]; nslog(@"the app registered types: %@", notificationsettings);
returns:
the app registered types: <uiusernotificationsettings: 0x15e9e790; types: (none);>
thanks in advance
that's because notification setting has been turned off in scheme setting.
ios objective-c xcode
No comments:
Post a Comment