Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top