Reputation: 1320
i'm trying to set push notifications for my new app and i have heard that in ios 6 device token changes each time the app is launched !
Is it true ?
Can someone tell me what i've changed to Apns in iOS 6 ?
Thanks a lot for any help. (i've google it do not worry)
Upvotes: 1
Views: 602
Reputation: 562
Regardless if the device token changes or not, it's best to re-register each time the app is launched to handle the possibility of a change (which CAN happen in some circumstances).
In your application:didFinishLaunchingWithOptions: you should use this code to avoid any problems that may arise due to the device token changing:
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types != UIRemoteNotificationTypeNone){
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
}
Upvotes: 0
Reputation: 394136
That's not true. Device Token rarely changes (it usually only changes if you change your iOS version or restore your device from a backup). In fact, all the applications on the same device have the same device token. And these things haven't changed in iOS6.
Upvotes: 1