No error but also not receive notification at mobile end APPLE device using php

倖福魔咒の 提交于 2019-12-11 01:58:36

问题


I am not good in english , i tried my best to explain question to you , if you don't understand then please ask me to explain.

I have a bunch of device tokens , i am fire notification to all the device tokens.This is a apple device token.

ex:

297257d9ae463410c992610a08cdff5655c2ab3cc4364fdffd6c9499df9e0cff
d520d52dfbb9f05938d1b1cbe6cf3b2452b2337df7c7696f927ac184c1eeec25
81ca0fc696bfce339f83738fde6bf3a5ffc5371b1b9c85e04e6a28ef490b9ce1
93e7b09753d3062ec0c0fd8ec89a920ee0918f9e484f5b6d72e7f4a3f7323x07
1438e78a3566cda13e2c65253ede2ccee217f3f321cad044c0922fd0c1b0cc33
6f3fc8506eca3465659211a8077af88c2d51a1e75528e5fe37b9c49258e0fz9e
8be640b2de8be3ed0b669a45de0301b33a5856a17eaf66488a7a2340fb173r9f
f8152ad30f66a0c80a2f21e4265d5fe462c8dc5b8be97cc49d4c7df865b63x11

This is my php code to fire a push notificaiton.

    foreach ($deviceTokens as $deviceToken) {
        try {
                $msg = chr(0) . pack('n', 32) . pack('H*', str_replace(' ', '', $deviceToken)) . pack('n', strlen($payload)) . $payload;
                $result = fwrite($fp, $msg, strlen($msg));
        } catch (Exception $e) {
                        continue;
        }
     }

the problem is due to some bad tokens notification is fired, but device is not receive that push notification.

In example 4th device token is bad token or expired token. 93e7b09753d3062ec0c0fd8ec89a920ee0918f9e484f5b6d72e7f4a3f7323x07.

so foreach loop fire notification for all devices , and i also print the result , it is printing the result upto last device, but devices token after 4th token not receive notification.

If i remove the 4th device token from the list then all the device receive the token, upto the last device token.

Is there any solution for this??

来源:https://stackoverflow.com/questions/45647651/no-error-but-also-not-receive-notification-at-mobile-end-apple-device-using-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!