ios 7设备 token 对于同一设备是不同的

标签 ios ios7 apple-push-notifications devicetoken

我在一台设备上有两个应用程序。对于 iOS 7,两个应用程序发送不同的设备 token ,但对于 iOS 6,两个应用程序发送相同的设备 token 。

根据我的理解,一台设备中的所有应用程序的设备 token 必须相同。 iOS7 与 iOS 6 有什么不同吗?

最佳答案

更新:

我想我读这篇文章的速度有点太快了。请注意我的修改。如果答案符合您的用例,请随时接受。

根据您的描述,我认为 iOS6 和 iOS7 之间的 token 生成发生了根本性变化。要更仔细地检查此行为,我建议您查看 Local and Push Notifications Programming Guide .在“安排、注册和处理通知”部分的指南中,您会发现 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.

引用:

当用户同意从 Apple 推送服务接收远程通知时,Apple 使用设备 token 。

通常通过以下方法访问设备 token :

- (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.

Device Tokens Used in the Apple Push Notification Service

UIDevice Identifier 也有重大变化(Apple 限制使用)。我建议阅读以下内容:

关于ios 7设备 token 对于同一设备是不同的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19524942/

相关文章:

ios - 什么最能代表角色 SKNode 或 SKSpriteNode?

ios - AudioQueue回调仅在iOS 7上获得空缓冲区

ios - 您什么时候会在推送负载中使用 "thread-id" key ?

ios - 当应用程序打开并且我收到推送时如何添加 uiviewcontroller?

ios - 在 iOS6 中发送推送通知

ios - 交互式过渡不是线性的

ios - RealmSwift : Detach an object from Realm, 包括其列表类型的属性

iphone - 崩溃日志不具有象征意义

audio - 使用Phonegap 2.9和iOS7录制后播放音频

ios - 当应用程序进入后台时如何继续套接字通信(iOS7)?