objective c - registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later -
when trying register push notifications under ios 8.x:
application.registerforremotenotificationtypes(uiremotenotificationtype.alert | uiremotenotificationtype.badge | uiremotenotificationtype.sound)
i following error:
registerforremotenotificationtypes: not supported in ios 8.0 , later.
any ideas new way of doing it? work when run swift app on ios 7.x.
edit
on ios 7.x when include conditional code (either systemversion conditional or #if __iphone_os_version_max_allowed >= 80000)
dyld: symbol not found: _objc_class_$_uiusernotificationsettings
as described, need use different method based on different versions of ios. if team using both xcode 5 (which doesn't know ios 8 selectors) , xcode 6 (currently in beta), need use conditional compiling follows:
#if __iphone_os_version_max_allowed >= 80000 if ([application respondstoselector:@selector(registerusernotificationsettings:)]) { // use registerusernotificationsettings } else { // use registerforremotenotificationtypes: } #else // use registerforremotenotificationtypes: #endif
if using xcode 6 (beta), can stick this:
if ([application respondstoselector:@selector(registerusernotificationsettings:)]) { // use registerusernotificationsettings } else { // use registerforremotenotificationtypes: }
the reason here way notification permissions has changed in ios 8. usernotification
message shown user, whether remote or local. need permission show one. described in wwdc 2014 video "what's new in ios notifications"
Comments
Post a Comment