Web 应用程序如何向 iOS 设备发送推送通知? [英] How can a web application send push notifications to iOS devices?

查看:37
本文介绍了Web 应用程序如何向 iOS 设备发送推送通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网络应用.如何在有新内容时向 iOS 用户发送推送通知?

I'm working on a web app. How can I send push notifications to iOS users when there is new content?

推荐答案

更具体地说,为了让 Web 应用程序向移动设备(例如 iPhone)发送推送通知,移动设备必须已注册才能接收特定应用程序的推送通知.推送通知的注册是通过原生应用完成的,并且只能通过原生应用进行.一旦本机应用程序注册推送通知,它就可以将授权令牌发送到服务器,该令牌可以与用于配置本机客户端的证书结合使用,以将推送通知发送到移动设备.

To be more specific, in order for a web application to send push notifications to a mobile device, such as the iPhone, the mobile device must have registered to receive push notifications for a particular application. The registration for push notification is done through a native app and can only be performed through a native app. Once the native app is registered for push notification, it can send the authorization token to the server, which can be used in conjunction with the certificate used to provision the native client, to send the push notifications to the mobile device.

如另一个答案中所述,一个选项是将您的 Web 应用程序包装"在本机应用程序中.这意味着您将创建一个本机应用程序,该应用程序基本上向显示您的 Web 应用程序的用户呈现 UIWebView(用于 iPhone 开发).虽然这与本机浏览器的功能大致相同,但您可以添加使用本机控件注册推送通知的功能.

As specified in another answer, one option is to 'wrap' your web application in a native application. Meaning that you would create a native application that basically presents a UIWebView (for iPhone dev) to the user showing your web application. While this pretty much functions in the same manner as the native browser, you would be able to add the ability to register for push notifications using the native controls.

查看 Apple 的推送通知文档会对您有所帮助,因为它提供了一些关于 iPhone 上的推送消息功能的非常好的信息.

It would be beneficial to you to review the Apple's push notification document as it provides some pretty good information on how push messaging functions on the iPhone.

请参阅 Peter Hosey 提供的这些链接:

See these links provided by Peter Hosey:

这篇关于Web 应用程序如何向 iOS 设备发送推送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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