推送通知如何工作以及它的要求是什么?

发布于 2024-08-07 03:47:58 字数 201 浏览 6 评论 0原文

我想知道如何让我的应用程序使用推送通知服务。我阅读了指南,但没有找到有关它的详细信息。有人可以告诉我一个简单的方法,它是如何工作的,有什么要求,如何我可以在我的应用程序中应用这个吗?我想知道一件事,根据指南,提供商和 APN 之间的连接必须是异步的,这是什么意思?我还读到,如果我们不断连接和断开 APNs 将阻止 IP。那么断开连接后连接APN的最小时间差是多少。请根据问题指导我。谢谢

i want to know how do i enable my application to use push notification service.i read the guide but doesn't find it much detailed information about it.Could someone tell me an easy way that how it works,what are the requirements,how do i apply this in my app. one thing i would like to know that according to guide the connection between provider and APNs must be asynchronous,What does it mean? also i read that if we continuously connect and disconnect APNs will block the IP. so what is the minimum time difference to connect to APNs after disconnecting.Please guide me in according to the question.thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑咖 2024-08-14 03:47:58

首先,网上有很多关于如何执行此操作的教程。

但基础知识如下:

  1. 您需要一台能够在收到应用程序通知时连接到 APN 的服务器。
  2. 然后,该服务器将使用 Apple 提供的 SSL 证书连接到 APN。
  3. 对于您必须发送的每条消息:
        一个。创建一条有效负载消息,您的应用程序可以使用该消息执行某些操作。
         b.包含您想要向其发送通知的 iPhone 的 deviceToken。
         c.将原始数据(有关格式的具体信息,请参阅 Apple 文档)写入每条消息的套接字。
  4. 断开与 APN 的连接。

Apple 所说的“异步”是指 APN 不会向您的任何数据发送响应以确认它。因此,您需要确保您用于连接的任何网络库都可以支持原始数据连接。

我认为我没有看到任何已发布的有关最短连接时间的指南。我认为 Apple 的注释更具体地旨在确保您批量发送消息,而不是恶意地淹没 APN。我怀疑如果他们觉得你越界了,他们会首先联系你。

再次,我建议您在 Google 上快速搜索“iphone 推送通知教程”,以获取可以进一步指导您的详细信息。

希望这对您有所帮助。

First off, there are quite a few tutorials out on the net for how to do this.

But here's the basics:

  1. You need a server that is able to connect to the APNs whenever you have notifications for your app.
  2. That server will then connect to the APNs using your Apple supplied SSL cert.
  3. For each messages that you have to send:
         a. Create a payload message that your app can do something with.
         b. Include the deviceToken for the iPhone you want to send notifications to.
         c. Write the raw data (see Apple's docs for specifics on the format) to the socket for each message.
  4. Disconnect from the APNs.

What Apple means by "asynchronous", is that the APNs will not send a response to any of your data acknowledging it. So you need to make sure that whatever networking library you're using to connect can support raw data connections.

I don't think I have seen any published guidelines for minimum time between connections. I think Apple's note is more specifically directed to ensure that you're batching your messages and not flooding the APNs maliciously. I suspect that they'll contact you first if they feel you're overstepping the bounds.

Again, I would suggest a quick Google search on "iphone push notification tutorial" for specifics that can guide you further.

Hope this helps you on your way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文