简体   繁体   English

iPhone推送通知随机发送

[英]iphone push notifications randomly sending

I have had push notifications setup for about a year now and they have been working fine. 我已经有大约一年的推送通知设置,并且它们运行良好。 Now for some reason they are not. 现在由于某种原因,他们不是。

First let me say that I am connections to apples apns servers and sending the push notifications via a PHP script. 首先,我要说的是我正在连接到Apple APNS服务器,并通过PHP脚本发送推送通知。

If I test sending a notification just to my device, it works every time. 如果我测试仅将通知发送到我的设备,则每次都可以使用。 If I test sending a notification to 3 or 4 of the devices I have here, they all work like they should. 如果我测试将通知发送到这里拥有的3或4个设备,则它们都会按应有的方式工作。 If I send a notification to all users (couple hundred) sometimes I will get the notifications and most of the time I wont. 如果我向所有用户(几百个)发送通知,有时我会收到通知,而大多数时候我不会。

I am connecting to apple once and sending all the notifications from the one connection. 我一次连接到Apple,然后从一个连接发送所有通知。 So it should not be an issue of apples connection limits. 因此,这不应成为苹果连接限制的问题。

Is there a limit that would not allow you to send to a couple hundred users? 是否存在不允许您发送给几百个用户的限制?

Its a couple hundred users, the notifications only get sent out maybe once or twice a week. 它有数百个用户,通知可能仅每周发送一次或两次。 I have tried setting a time delay between each message but that didn't seem to make a difference. 我尝试设置每个消息之间的时间延迟,但这似乎没有什么不同。

does anyone have any ideas what could be happening or what I should check? 有谁知道会发生什么或我应该检查什么?

Are you doing any error checking? 您正在执行任何错误检查吗? Are you using the "simple" or "extended" format? 您使用的是“简单”还是“扩展”格式? Are you parsing the result of the extended format? 您在解析扩展格式的结果吗? How long do you wait for the notifications to be received? 您需要等待多长时间才能收到通知? Do you detect when Apple closes the connection? 您是否检测到Apple关闭连接的时间? Do you check the feedback service? 您检查反馈服务吗?

I don't think you're supposed use a (short-lived) PHP script. 我不认为您应该使用(短期)PHP脚本。 Apple doesn't seem to send you anything on a successful notification, and there's not really another easy way to ensure that data has been received (and processed) by the other side of the connection. Apple似乎不会在成功发送通知时向您发送任何信息,并且确实没有另一种简便的方法来确保连接的另一端已接收(并处理)了数据。

It's also worth checking that you comply with the iOS Developer Program Licence Agreement Push Notification requirements on page 22 (no direct marketing, no excessive use). 还值得检查您是否遵守第22页上的iOS开发者计划许可协议推送通知要求(禁止直接营销,请勿过度使用)。

OK, I got it all sorted out. 好吧,我把所有事情都整理好了。 It was on my servers end, I had a cron job that was not running the php script correctly after fixing that everything started working, no need to change anything in my PHP scripts. 它在我的服务器端,我的cron作业修复了所有内容开始起作用后,没有正确运行php脚本的情况,因此不需要更改我的PHP脚本中的任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM