Can I send an image with Apple's Push Notifica

2019-02-10 02:01发布

问题:

I need to show an image whenever my application receive Notification.

Does Apple push notification support image sending?

Update

If above thing is not possible can we show image from url on UIAlertview when we receive notification.

回答1:

No. The notification payload can be up to 256 bytes long. You can send an image only if the encoded image size plus the rest of the payload is no more bigger than that... useless.

You can, however, use launch-image property from alert apn dictionary to specify an image from app bundle that will be used at app launch.

Or you can send a URL from which the image can be downloaded within the app.

Please take a look at Apple Docs



回答2:

As far as Push Notifications go, when the user actions the notification or the notification is received while the app is in the foreground, the app will only get the push message payload. The only intent is to let the user know that there is new content.

Hence, you should not be using Push Notifications to deliver content to your app. Your app should be responsible for pulling any new content from your backend server as soon as it is in a position to do so.

UPDATE: However, if you mean "emoji" this might help you.