iphone - How to access deviceToken when registering for push notifications in iOS 8? -
i should preface saying i’ve checked this , this, neither of these 2 accepted answers has solved issue.
i’m using third-party force notification service, , registerdevice
method requires devicetoken
, such returned application:didregisterforremotenotificationswithdevicetoken:
. however, in ios 8, method deprecated, , replaced application:didregisterusernotificationsettings:
, can see has no devicetoken
.
i’ve tried adding method, called, , hoped trigger manual phone call didregisterforremotenotifications
, hasn’t worked. used this:
- (void)application:(uiapplication *)application didregisterusernotificationsettings:(uiusernotificationsettings *)notificationsettings { [application registerforremotenotifications]; }
basically, need access devicetoken
, , have no means of doing newly-preferred application:didregisterusernotificationsettings
callback.
everything fine in ios 7, in ios 8, token seems unavailable. how can solve this?
i think mistaking. callback registerforremotenotifications
didregisterforremotenotificationswithdevicetoken
, not deprecated in ios8 @ all. tested works fine.
in app delegate, ios8 do
uiusernotificationtype usernotificationtypes = (uiusernotificationtypealert | uiusernotificationtypebadge | uiusernotificationtypesound); uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:usernotificationtypes categories:nil]; [application registerusernotificationsettings:settings]; [application registerforremotenotifications];
the callback
- (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devicetoken ns_available_ios(3_0);
ios iphone cocoa-touch push-notification apple-push-notifications
No comments:
Post a Comment