immobiliare / ApnsPHP

ApnsPHP: Apple Push Notification & Feedback Provider
BSD 3-Clause "New" or "Revised" License
1.44k stars 452 forks source link

No error shown, nor the notification received #122

Open Zaeembinrehman opened 8 years ago

Zaeembinrehman commented 8 years ago

Hello there,

No error is thrown nor does the devie receives the notification. I got the following logs when the push is tried to send to the device:

Thu, 07 Apr 2016 15:39:01 +0100 ApnsPHP[8048]: INFO: Trying tls://gateway.sandbox.push.apple.com:2195...

Thu, 07 Apr 2016 15:39:01 +0100 ApnsPHP[8048]: INFO: Connected to tls://gateway.sandbox.push.apple.com:2195.

Thu, 07 Apr 2016 15:39:01 +0100 ApnsPHP[8048]: INFO: Sending messages queue, run #1: 1 message(s) left in queue.

Thu, 07 Apr 2016 15:39:01 +0100 ApnsPHP[8048]: STATUS: Sending message ID 1 custom identifier: Message-Badge-3: 150 bytes.

Thu, 07 Apr 2016 15:39:01 +0100 ApnsPHP[8048]: INFO: Disconnected. 1

What could be the issue here, please help.

rrecurse commented 7 years ago

It may help to look at the error messages via getErrors() method. Here's an example:

 $error = '';
 $aErrorQueue = $push->getErrors();

 if(!empty($aErrorQueue)) {

        foreach($aErrorQueue as $error){            
            foreach($error['ERRORS'] as $err){
                $error .=  $err['statusMessage'] . ' ' . ' Error code: ' . $err['statusCode'];
            }
        }
}

The error queue is only populated when there is an error. You can modify the pseudo code above as needed. I'd recommend combining the token that failed in your error response. - Hope that helps.