When IOS uses APNS to push Payload in bytes, the push fails.

Source: Internet
Author: User

When IOS uses APNS to push Payload in bytes, the push fails.


In the past two days, you need to add a script to the push. You can add a script to the badge method. However, the push fails. I have been depressed for a long time and search for relevant information online.
I finally found the reason:
"Payload -- a maximum of 256 bytes."

It turns out that the payload Bytes Sent exceeds the specified characters.
Use payload. getBytes (). length to get the number of bytes. Check that the number of characters below is 240 bytes, no more than 256. After repeated tests, we know that bytes is not accurate enough. Some values in the original payload are removed (loginUri logon, uri is used for redirect). test again and push is successful.


========= Payload ==========
Originally:

{"LoginUri": "http: // 192.168.1.8: 8086/admin/msm/login", "messageID": "580", "aps": {"alert ": "Zheng zixuan sent you a work item", "sound": "default", "badge": 5}, "uri": "http: // 192.168.1.8: 8086/admin/msm/login? Module = WEIBO & moduleId = 93f7cf993df34d3dbc1681f08cced08c "}=== number of bytes === 250
New:

{"MessageID": "608", "aps": {"alert": "Zheng zixuan sent you a work item", "sound": "default "}, "uri": "http: // 192.168.1.8: 8086/admin/msm/login? Module = WEIBO & moduleId = caedadfd80f841538a3414ca737c2ab0 "}=== number of bytes === 187
======================================

Original address: http://www.eqishare.com/read.php? Tid-980.html

More articles: http://blog.sina.com.cn/s/articlelist_1238625327_5_1.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.