IOS 7设备令牌是相同的设备不同 [英] ios 7 device token is different for same device

查看:216
本文介绍了IOS 7设备令牌是相同的设备不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个设备两个应用程序。对于iOS 7这两个应用程序发送不同的设备令牌但对于iOS 6的两个应用程序发送相同的设备令牌。

按我的理解,设备令牌是同为一台设备的所有应用程序。难道还有比iOS 6中不同的东西在iOS7?


解决方案

更新:

我想我太快速阅读这一个位。请注意我的修订。如果答案满足您的使用情况请随时接受它。

根据您的描述,我建议有过到iOS6的和iOS7的令牌生成根本的变化。为了更仔细地检查这种行为,我建议你看一看的<一个href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html\">Local和推送通知编程指南。在该指南中的一节调度,注册,和处理通知,一会从苹果觉得这种说法。


  

设备令牌可以改变的。您的应用程序需要重新注册每次都
  启动 - 在iOS中通过调用registerForRemoteNotificationTypes:
  的UIApplication的方法,以及在OS X中通过调用
  registerForRemoteNotificationTypes:的NSApplication方法。该
  传递给此方法参数指定初始类型
  该应用程序希望接收通知。用户可以修改
  启用通知类型的任何一点,利用设置在iOS或
  在OS X系统preferences可以查询当前已启用
  使用enabledRemoteNotificationTypes物业通知类型
  UIApplication的或的enabledRemoteNotificationTypes财产
  的NSApplication。系统不徽章图标,显示警报
  消息或警报播放声音,如果这些通知类型是
  为您的应用程序未启用,即使他们在指定
  通知有效负载。


参考:

苹果使用的设备令牌时用户同意从苹果推送服务接收远程通知。

通常情况下,设备令牌在下面的方法访问:

   - (无效)应用:(*的UIApplication)的应用didRegisterForRemoteNotificationsWithDeviceToken:(NSData的*)deviceToken


  

deviceToken
  标识设备APS的标记。该令牌是一个不透明的数据
  类型,因为这是供应商需要提交表单
  当它发送通知到设备的APS服务器。该APS服务器
  需要性能原因二进制格式。


  
  

请注意,该设备令牌是唯一标识符不同
  的UIDevice的财产,因为,出于安全和保密原因,
  必须改变时擦除设备。


有同样的标识符的UIDevice变化显著(苹果公司已经限制使用)。我建议以下内容如下:

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:

这篇关于IOS 7设备令牌是相同的设备不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆