0

I have read many answers on this topic but issue not resolved by suggested solutions. My issue is that I am not getting Push Notifications for Production Certificate. Same Push Notifications are successfully getting in Development certificate. I specially want to say that my device tokens for production and development environment is entirely different. So there is no issue for same device token. Also, i am using different profiles for both. Means to say, there is not configuration issue on app level.

We are using PHP as a server that is sending push notifications.

Here are my two questions:

  1. Is there any thing missing at server side? For which PHP server is sending Push Notifications for development environment successfully and for Production environment, its generating problem?
  2. Am i missing any thing in the app?

I will be very thankful to all of you. I am stuck on this issue. Many Thanks in advance

Bob Gilmore
  • 12,608
  • 13
  • 46
  • 53
msmq
  • 1,298
  • 16
  • 28

2 Answers2

0

check php function for iphone push notification...

function iphone_notification($deviceToken,$message,$not_type,$sound,$vibration_type){
            $passphrase = '******';
            $ctx = stream_context_create();
            stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
            stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
            $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
            $body['aps'] = array('alert' => $message, 'sound' => $sound);
            $body['notification_type'] = $not_type;
            $body['vibration_type'] = $vibration_type;
            //1 = news;
            //99 = other;
            //echo $err."<br>".$errstr;
            $payload = json_encode($body);
            $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
            $result = fwrite($fp, $msg, strlen($msg));
            fclose($fp);
    }
BenMorel
  • 34,448
  • 50
  • 182
  • 322
nitin kachhadiya
  • 959
  • 2
  • 9
  • 21
0

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

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