是否可以在回调 didRegisterForRemoteNotificationsWithDeviceToken 中使用 deviceToken 来唯一标识一台设备

Can one use the deviceToken in the callback didRegisterForRemoteNotificationsWithDeviceToken to uniquely identify a device

当设备注册远程推送通知时,将回调以下方法。

(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

我的问题是

  1. 能否使用此(deviceToken)来唯一标识设备。如果是,那么它的生命周期是多少(我的意思是它真的很独特)?
  2. 提供的deviceToken在什么情况下可以改变?
  3. 如果在设备生命周期内(对于特定的应用程序供应商)这是每台设备唯一的,那么可以使用它作为 Unique Identification of iOS device 的替代方案吗?

编辑 本想在题目中写device,结果写user

关于您的第一个问题 - 推送设备令牌未链接到用户。如果同一用户登录到另一台设备,他将获得不同的令牌,如果另一用户登录到同一台设备,他也将与用户 1 共享令牌。

为了回答第二个和第三个问题,这里是 Apple 文档中的示例文本:

The form of this phase of token trust ensures that only APNs generates the token which it will later honor, and it can assure itself that a token handed to it by a device is the same token that it previously provisioned for that particular device—and only for that device.

If the user restores backup data to a new device or reinstalls the operating system, the device token changes.

因此,问题的症结在于设备推送令牌不得用作唯一标识符或 UUID 的替代。

编辑: 根据上述 Apple 文档,根据 OP 编辑​​,由于推送设备令牌可以更改,因此不应将其视为 设备的唯一标识符