0

当我尝试发送以下有效负载以在 iphone 上生成推送通知时,我收到一条成功消息,但没有收到任何推送通知。

我想知道这个有效载荷的格式是否有效?

{
    "aps": {
        "alert": "green commented on your post: 'push post for tim'. Comment is: hey hi!",
        "sound": "default"
    },
    "type": "comment",
    "post": {
        "post_id": "168",
        "post_title": "push post for tim",
        "post_content": "testing push",
        "post_status": "1",
        "is_favorite": "0",
        "post_comment_count": "9",
        "username": "test1",
        "category": "uncategorized",
        "relevancy": "0%",
        "creator_num": "85",
        "type": "Manual",
        "lat": "0.000000",
        "lon": "0.000000",
        "auto_end_date": "0000-00-00",
        "access": "Private",
        "post_image": "http://thepost.com/admin/uploads/thumb/post_default.jpg",
        "post_comments": "9"
    }
}

当我仅发送此有效负载时,推送正在工作:

{
    "aps": {
        "alert": "green commented on your post: 'push post for tim'. Comment is: hey hi!",
        "sound": "default"
    }
}

有任何想法吗?

4

1 回答 1

1

通知有效负载的最大大小为 256 字节。APNS 将拒绝任何超过限制的通知。您的有效负载是 567 字节,这就是您没有看到通知通过的原因。

来源:http: //developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html

于 2013-03-31T21:46:37.653 回答