我可以使用 Apple 的推送通知服务发送图像吗? [英] Can I send an image with Apple's Push Notification Service?

查看:37
本文介绍了我可以使用 Apple 的推送通知服务发送图像吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我的应用程序收到通知时,我都需要显示图像.

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

Apple 推送通知是否支持图片发送?

Does Apple push notification support image sending?

更新

如果上述事情是不可能的,我们可以在收到通知时在 UIAlertview 上显示来自 url 的图像.

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

推荐答案

更新! iOS 10 引入了向推送通知添加媒体附件的功能.所以现在我们有能力在推送通知中包含图像.[来源:Andrew 来自评论和其他展示如何执行此操作的教程,例如 这个.]

Update! iOS 10 introduced the ability to add media attachments to push notifications. So now we have the ability to include an image in a push notification. [Source: Andrew from comments, and other tutorials that show how to do this, such as this one.]

没有.通知负载最长可达 256 字节.只有当编码的图像大小加上其余的有效载荷不大于那个大小时,您才能发送图像......没用.

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.

但是,您可以使用 alert apn 字典中的 launch-image 属性来指定应用程序包中将在应用启动时使用的图像.

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.

或者您可以发送一个 URL,从中可以在应用程序中下载图像.

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

请看一下Apple 文档

这篇关于我可以使用 Apple 的推送通知服务发送图像吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆