Image previews in Notification Center

…衆ロ難τιáo~ 提交于 2019-12-06 05:51:03

问题


Is it possible to add an image to a push notification's payload? I've seen it being done in the Photos & Messages apps. I was hoping this wasn't some private Apple API.

The screen shot below was taken on a device running iOS 6.


回答1:


Is not possible

According to the Push Notification Programming guide the payload max size should not exceed 256 Bytes:

Documentation extract:

Payload length—The length of the payload in network order (that is, big endian). The payload must not exceed 256 bytes and must not be null-terminated.

Here´s the Apple Documentation link :

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW1




回答2:


you can try to use a workaround idea that i used.

instead of pushing the image\sound (size limit problem) you can just push a URL and catch the pushing event. after that you have the address of the image\sound file that you want to be pushed and just download it (in the push notification received event) and thats it.



来源:https://stackoverflow.com/questions/14399781/image-previews-in-notification-center

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!