0

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 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.

Community
  • 1
  • 1
Paresh Masani
  • 7,474
  • 12
  • 73
  • 139

3 Answers3

0

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.

picciano
  • 22,341
  • 9
  • 69
  • 82
  • Thank you but I am using correct enviroment only. As I mentioned I have just created development certificate and all. I haven't submitted my application in app store yet. I heard a lot about Urban Airship. I am wondering why one need separate paid service when its just a matter of sending messages to APNS server? Rest of things will be taken care by Apple. I might be missing something obvious as I am beginner in Push Notification world. – Paresh Masani May 09 '11 at 20:21
0

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.

Paresh Masani
  • 7,474
  • 12
  • 73
  • 139
-1

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 >>

Community
  • 1
  • 1
Ranjitsingh Chandel
  • 1,479
  • 6
  • 19
  • 33