mac-cain13 / notificato

Takes care of Apple push notifications (APNS) in your PHP projects.
MIT License
224 stars 44 forks source link

Push notification is not being delivered to device #61

Closed tahirwaseer closed 6 years ago

tahirwaseer commented 8 years ago

When I require this package via composer it gives me dependency error for openssl. Now I have updated version of openssl on my mac but it is still giving this error;

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for wrep/notificato ^1.2 -> satisfiable by wrep/notificato[1.2.0].
    - wrep/notificato 1.2.0 requires lib-openssl * -> the requested linked library openssl has the wrong version installed or is missing from your system, make sure to have the extension providing it.

I is not clear from the message that which openssl version is required. Here my current version of openssl; OpenSSL 1.0.2h 3 May 2016 Please let me know if can change any version to make it work?

mac-cain13 commented 8 years ago

If you look at the phpinfo() output, does that mention the OpenSSL library? If it does it should be correctly linked and loaded, if it doesn't PHP is probably installed without OpenSSL linked.

tahirwaseer commented 8 years ago

@mac-cain13 thank you for responding. I have installed and used this library to send push notification to apple passbook in order to update installed coupon on device. Here is the feedback output;

screen shot 2016-08-30 at 2 19 52 am

It doesn't seem to be unsuccessful but coupon is not being updated on device. No message is being received on device.

mac-cain13 commented 8 years ago

The feedback service is telling you that that particular device did unregister from APNS and you cannot send push messages to it anymore. That you can use the feedback service without errors doesn't tell you anything about whether pushes are correctly delivered or not.

Do you get any errors when you send a push? If so what errors. What is your code sending the push and does the passbook pass register with your server correctly?

tahirwaseer commented 8 years ago

Device has been registered correctly and that pass is being updated when I try to update it from passbook application using pull to refresh. Here is my code for sending push notification.

$notificato = new Notificato(base_path().'/config/ios-push-notification-certificates/production/ProductionCertificate.pem', 'mypassphrase');

        // Now we get a fresh messagebuilder from Notificato
        //  This message will be send to device with pushtoken 'fffff...'
        //  it will automaticly be associated with the default certificate
        //  and we will set the red badge on the App icon to 1
        $message = $notificato->messageBuilder()
                                ->setDeviceToken('b2ae8b68fff1fbbe957b8b8f703744794d89f09d45f69b2d847a26c3b064e268')
                                ->setBadge(1)
                                ->build();

        // The message is ready, let's send it!
        //  Be aware that this method is blocking and on failure Notificato will retry if necessary
        $messageEnvelope = $notificato->send($message);

        // The returned envelope contains usefull information about how many retries where needed and if sending succeeded
        // Now read all "tuples" from the feedback service, be aware that this method is blocking
        $tuples = $notificato->receiveFeedback();

        // The tuples contain information about what device unregistered and when it did unregister.
        //  Don't forget to check if the device reregistered after the "invaidated at" date!
        foreach ($tuples as $tuple)
        {
            echo 'Device ' . $tuple->getDeviceToken() . ' invalidated at ' . $tuple->getInvalidatedAt()->format(\DateTime::ISO8601) . PHP_EOL;
        }
        dd($messageEnvelope->getFinalStatusDescription());