ios APNS错误响应报文中不同状态码的含义

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12446705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 20:09:47  来源:igfitidea点击:

Meaning Of Different Status Codes In APNS Error Response Packets

iospush-notificationapple-push-notifications

提问by Raj Chaudhari

APNS returns the following status codes in error response packets when using the enhanced notification format.

APNS使用增强的通知格式时返回错误响应数据包以下状态代码。

0   - No errors encountered
1   - Processing error
2   - Missing device token
3   - Missing topic
4   - Missing payload
5   - Invalid token size
6   - Invalid topic size
7   - Invalid payload size
8   - Invalid token
255 - None (unknown)

I want to know which of these status codes actually indicate that the issue is actually with the device token (ie: I can mark that particular device token in my database as invalid or inactive). I am sure that I can safely do that when I receive a value of 8 as status code. Also, I am pretty sure about what status codes 2, 4, 5 and 7 indicate and when exactly are they returned.

我想知道这些状态代码中的哪一个实际上表明问题实际上与设备令牌有关(即:我可以将数据库中的特定设备令牌标记为无效或不活动)。我确信当我收到值 8 作为状态代码时,我可以安全地做到这一点。此外,我非常确定状态代码 2、4、5 和 7 表示什么以及它们何时返回。

But for the rest of the status codes, I am pretty much in the dark. Apple's website does not contain much information about them either.

但对于状态代码的其余部分,我在黑暗中漂亮多了。Apple 的网站也没有包含太多关于它们的信息。

Can anybody please enlighten me about each of these status codes in detail. Many thanks in advance.

任何人都可以详细介绍这些状态代码中的每一个。提前谢谢了。

回答by Nick

You're right about the 2, 4, 5, 7, and 8. 0 is good news obviously. We're left with:

关于 2、4、5、7 和 8,您是对的。0 显然是个好消息。我们只剩下:

1   - Processing error
3   - Missing topic
6   - Invalid topic size
10  - Shutdown
255 - None (unknown)

1 is a problem on Apple's side, not related to the token.

1 是 Apple 方面的问题,与令牌无关。

3 is, according to Apple:

3 是,根据Apple 的说法:

The topic is currently the bundle identifier of the target application on an iOS device.

6 is related to 3.

6 与 3 相关。

10 is out of your control but good to handle as well.

10 是你无法控制的,但也很好处理。

And obviously, 255 will not be able to help you define if the token is the problem.

显然,255 将无法帮助您定义令牌是否是问题所在。

If your goal is to determine a token that was valid at some point and no longer is, you should really refer to the Feedback Service API.

如果您的目标是确定某个时间点有效且不再有效的令牌,您应该真正参考反馈服务 API