iOS 推送通知的设备令牌示例

iOS Device Token example for Push Notifications

我需要通过server auth方式,需要deviceToken进行注册。 但我只有模拟器,不能从它们那里获取令牌,我想向服务器发送虚假令牌(比如 000 000 000) 但我不知道设备令牌中有多少位数字。 谁能帮我提供一个示例设备令牌?

是32字节。以十六进制书写,它们将占用 64 位数字。

您可以查看此页面了解更多详情:

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html

设备令牌为 32 字节。 raywenderlich

提供了示例设备令牌供您参考
740f4707 bebcf74f 9b7c25d4 8e335894 5f6aa01d a5ddb387 462c7eaf 61bb78ad

Apple 本地和远程通知编程指南 明确指出:

"Important: APNs device tokens are of variable length. Do not hardcode their size."

目前可能有 32 个字节,但硬编码会使您的应用程序在将来崩溃!