I have two applications in one device. For iOS 7 both applications are sending different device tokens but for iOS 6 both apps are sending same device token.
As per my understanding device token has to be same for all the application in one device. Is there something different in iOS7 than iOS 6?
UPDATE:
I guess I read this one a bit too quickly. Please note my revisions. If the answer meets your use-case please feel free to accept it.
Based on your description I would suggest that there have been underlying changes to the token generation between iOS6 and iOS7. To examine this behavior more closely I recommend that you take a look at the Local and Push Notifications Programming Guide. Within the Guide in the section for "Scheduling, Registering, and Handling Notifications," one will find this statement from Apple.
Device tokens can change. Your app needs to reregister every time it
is launched—in iOS by calling the registerForRemoteNotificationTypes:
method of UIApplication, and in OS X by calling the
registerForRemoteNotificationTypes: method of NSApplication. The
parameter passed to this method specifies the initial types of
notifications that the application wishes to receive. Users can modify
the enabled notification types at any point, using Settings in iOS or
System Preferences in OS X. You can query the currently enabled
notification types using the enabledRemoteNotificationTypes property
of UIApplication or the enabledRemoteNotificationTypes property of
NSApplication. The system does not badge icons, display alert
messages, or play alert sounds if any of these notifications types are
not enabled for your app, even if they are specified in the
notification payload.
Reference:
Apple uses device tokens when users agree to receive remote notifications from the Apple Push Service.
Typically the device token is accessed in the following method:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
deviceToken
A token that identifies the device to APS. The token is an opaque data
type because that is the form that the provider needs to submit to the
APS servers when it sends a notification to a device. The APS servers
require a binary format for performance reasons.
Note that the device token is different from the uniqueIdentifier
property of UIDevice because, for security and privacy reasons, it
must change when the device is wiped.
There are also significant changes to the UIDevice Identifier (Apple has restricted usage). I would suggest the following reads:
- Stackoverflow Question on new device id (token) behaviors
- Apple Documentation Showing Use of the Device identifier
- Apple Documentation Showing How to Use the Advertising
Identifier
- UIDevice Class Reference
This one was also helpful.Please see point 1 in this article:
https://support.urbanairship.com/customer/portal/articles/1321513-how-ios-7-handles-push-differently
"Prior to iOS 7, the device token was the same across all app installations on a given device. Different apps on your phone, whether Tap Tap Revenge or USA Today, would utilize the same address, i.e., device token, to route the push notification to you. The security credentials that you pair with a message would ensure it made it to the right app. On iOS 7, Apple has gone one step further and made sure that device tokens are now different in every single app install. This helps further protect users’ privacy by removing another phone-level identifier."
Though this is very late answer, I want to share my test done for i0S 9.2.1.
The device token is unique for each app in a device. A new device token will be generated each time we install an app. As far as I know, apple has changed its policy for device token after they released iOS7.