immobiliare / ApnsPHP

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

$push->getErrors() not returns identifiers #151

Closed isayeter closed 7 years ago

isayeter commented 7 years ago

Hello,

After calling $push->send() method I want to get which queues are not succeed.

In order to see that I'm calling $push->getErrors() method, but it gives that output:

Array
(
    [1] => Array
        (
            [MESSAGE] => ApnsPHP_Message Object
                (
                    [_bAutoAdjustLongPayload:protected] => 1
                    [_aDeviceTokens:protected] => Array
                        (
                            [0] => a60ea7356c4f6x5a8c34861907a1a7e9d5fa459467e412edceed7406b7edfb8c
                        )

                    [_sText:protected] => blablabla message
                    [_nBadge:protected] => 1
                    [_sSound:protected] => default
                    [_sCategory:protected] => 
                    [_bContentAvailable:protected] => 
                    [_aCustomProperties:protected] => Array
                        (
                            [key] => general
                        )

                    [_nExpiryValue:protected] => 604800
                    [_mCustomIdentifier:protected] => normalQueueId1
                )

            [BINARY_NOTIFICATION] => X�J$ ��5lOnZ�4������E�g����t�����{"aps":{"alert":{"body":"blablabla message"},"badge":1,"sound":"default"},"key":"general"}
            [ERRORS] => Array
                (
                    [0] => Array
                        (
                            [command] => 8
                            [statusCode] => 8
                            [identifier] => 1
                            [time] => 1490358180
                            [statusMessage] => Invalid token
                        )

                )

        )
)

From that output, I can not access the identifier of the failed queue which is (normalQueueId1), because it is protected.

Is there another method that I can retrieve failed push notification queues with their full properties including identifier ?

Thank you.

isayeter commented 7 years ago

Sorry, my mistake, there is already a method to retrieve identifier.

MESSAGE_OBJECT->getCustomIdentifier();