I work on project on Symfony and i have a problem with NotificationPusher from this github repo : https://github.com/Ph3nol/NotificationPusher
I explain myself, I manage to create my wallet with all the necessary information, I get a push token and everything I need in passbook registrations to update my wallet but I can't send push notifications on IOS.
Notifications are visible but only when I refresh my wallet.
Here is the code I use copied from the demo on the github.
I checked that I get all my information correctly :
public function sendIOS(string $pushToken, $notification = null): void
{
$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);
// Then declare an adapter.
$apnsAdapter = new ApnsAdapter([
'certificate' => __DIR__ . '/../../AppleCertificate/Certificate.pem',
'passPhrase' => $this->params->get('IOS_PASS_PASSPHRASE'),
]);
// Set the device(s) to push the notification to.
$devices = new DeviceCollection([
new Device($pushToken, ['badge' => 1])
]);
// Then, create the push skel.
$message = new Message('This is an example.', array(
'badge' => 1,
'sound' => 'example.aiff',
'actionLocKey' => 'Action button title!',
'locKey' => 'localized key',
'locArgs' => array(
'localized args',
'localized args',
'localized args'
),
'launchImage' => 'image.jpg',
'custom' => array('custom data' => array(
'we' => 'want', 'send to app'
))
));
// Finally, create and add the push to the manager, and push it!
$push = new Push($apnsAdapter, $devices, $message);
$pushManager->add($push);
$pushManager->push();
}
Also, I checked the returns and tried to dump a possible error but everything tells me that the notification has been sent, but it never appears on my phone except when I refresh the wallet.
Thanks for help ! :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…