iOS using APNs push payload byte limit causes push to not succeed

Source: Internet
Author: User


This 2 days need to add a script on the push, found the badge method can add script. Plus, but how to push is not successful. Depressed for a long time, on the Internet to find relevant information.
I finally found the reason:
"payload--up to 256bytes. "

It turns out that the payload bytes sent exceed the specified characters.
use Payload.getbytes (). length to get the number of bytes. See the next character number 240 bytes, no more than 256, repeated testing, learned that 256bytes is not accurate enough. The original payload some of the values are removed (Loginuri login, URI for jump), test again, push successfully.


========payload=========
Original:

{"Loginuri": "Http://192.168.1.8:8086/admin/msm/login", "MessageID": "580", "APS": {"alert": "Zheng sends 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 sends 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

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.