objective c - starting to work with iOS push notifications -
i started following tutorial found via google.
http://code.tutsplus.com/tutorials/setting-up-push-notifications-on-ios--cms-21925
however got stuck on first step said methods deprecated, changed them ones suggested xcode original code
[application registerforremotenotificationtypes:(uiremotenotificationtypealert | uiremotenotificationtypebadge | uiremotenotificationtypesound)];
i changed
[application registerforremotenotification:(uiremotenotificationtype | uiremotenotificationtype | uiremotenotificationtypesound)];
but keep getting error message saying " expected expression "
i'm still @ first step here, tutorial i'm following ios 6 i'm working on ios 8 , can't find full tutorials on how implement push notifications application. can point me in right direction ?
you using api wrongly.
first of push notification api has changed after ios 8.0.
my answer assume want still supporting ios 7.x , later
// checks if application responds api introduced in ios 8. if ([application respondstoselector:@selector(registerusernotificationsettings:)]) { // ios 8 support // note pass object of type uiusernotificationsettings parameter instead of enums only. [application registerusernotificationsettings:[uiusernotificationsettings settingsfortypes:(uiusernotificationtypealert | uiusernotificationtypebadge | uiusernotificationtypesound) categories:nil]]; } else { // old api use same code tutorial [application registerforremotenotificationtypes:(uiremotenotificationtypealert | uiremotenotificationtypebadge | uiremotenotificationtypesound)]; }
Comments
Post a Comment