davibennun / laravel-push-notification

Laravel package to enable sending push notifications to devices
1.23k stars 260 forks source link

Strange APNS response #82

Open tristangodfrey opened 8 years ago

tristangodfrey commented 8 years ago

I've been struggling with this issue for quite a while now, and I'm sure my issue is probably quite trivial. I just can't figure out what it is.

I'm trying to send notifications to device tokens, and I'm logging the response like so:

/// get response for each device push
    foreach ($collection->pushManager as $key => $push) {
        $response = $push->getAdapter()->getResponse();
        Log::info("Response #".$key.": " . print_r($response));
    }

This always outputs the following:

[2015-12-12 20:14:03] production.INFO: Sending notification to 2 devices. [] []
[2015-12-12 20:14:03] production.INFO: Response #0: 1 [] []

If I understand correctly $response would correspond to the APNS response status code: 1 - Processing error.

Can anyone give me a push in the right direction for figuring out what might be going wrong here?

asafl commented 8 years ago

+1

tristangodfrey commented 8 years ago

@asafl Have you found a solution yet?

knvpk commented 8 years ago

I think APNS directly didn't get the response, you need to use feedback

asafl commented 8 years ago

I think @pavankumarkatakam is right... I don't have a better answer :)

tristangodfrey commented 8 years ago

@pavankumarkatakam So I should try getFeedback instead of getResponse?

tristangodfrey commented 8 years ago

@asafl What is your approach for troubleshooting this? I'm currently logging like this:

Log::info("Response #".$key.": " . var_dump($response));
Log::info("Feedback #".$key.": " . var_dump($feedback));

But all I get is empty variables, does this mean anything? I'm on Laravel 4.2 btw and probably and older version of this package too

siyei commented 8 years ago

+1

knvpk commented 8 years ago

getFeedback() only return the error tokens, it means you can delete that token from DB And not send to those device.