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