开发者

Don't get push notification messages

I have created APNS development certification successfully, signed the code with mobileprovision certificate, and also generated .p12 and .pem certificates.I have successfully got the device token and also have application installed on my iPhone.

I have tried testing script PHP(https://devforums.apple.com/message/50461) and Python (Apple PNS (push开发者_JS百科 notification services) sample code) and both are running fine without any error messages but I am not getting Push Notification Alert on my iPhone. Initially I had this but it is resolved. I know that APNS messages are not guaranted but is it possible they get lost totally? I tried sending multiple messages but non of them appeared.

Could anyone please help me to understand what could be going wrong?

Thanks.


One possibility, be sure you are using the correct environment, sandbox for apps in development, and production for those downloaded from the app store.

You could also sign up for a free account with Urban Airship to help troubleshoot. They have a test control panel for sending push notifications.


Resolution:

Replacing following line

$msg = chr(0) . chr(0) . chr(32) . base64_decode($token64) . chr(0) . chr(strlen($payload)) . $payload;

with

$msg = chr(0) . chr(0) . chr(32) . pack('H*', $token64) . chr(0) . chr(strlen($payload)) . $payload;

worked..!! Based on this formar method - base64_decode appends extra characters and hence, it didn't work.


Please check answers of this question

I faced this same problem. If your .pem file is correct then using following setting you will get push notification. (check terminal commands to make .pem)

//for development profile
$apns_url = 'gateway.sandbox.push.apple.com';

//for production you should use this
$apns_url = 'gateway.push.apple.com';s. 

for more detail check this link1 >> link2 >>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜