且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Web应用程序如何向iOS设备发送推送通知?

更新时间:2022-12-21 13:23:07

更具体地说,为了网络在向移动设备(例如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:

  • https://support.apple.com/kb/HT201925
  • https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html