Undefined index: headers
ankitindianic opened this issue · 7 comments
I have using this package and pass all parameter but this error is found **Undefined index: headers File: /var/www/html/indiaNic-work/echo-loud/laravel/vendor/edujugon/push-notification/src/Apn.phpLine: 255 **
Same issue, if some one has fixed it plz lemme know.Thanks
Same issue, if some one has fixed it plz lemme know.Thanks
any update on this issue...
vendor\edujugon\push-notification\src
download Apn.php in bellow url. replace given in file. it will work find.
https://github.com/darshantank1995/apnforpushnotification/blob/master/Apn.php
thanks @darshantank1995 ... but the problem is, this is issue happened in current release v5.0.0, your file works fine but it's the old code with APN sandbox URL. @Edujugon have any time to look into it
I just ran into this the past few days. If you update your payload to contain a headers key it will get around that error. Just testing this in production, you now need to specify an apns-topic which is the bundle ID when using a production certificate.
$push->setMessage([
'aps' => [
'alert' => [
'title' => 'This is the title',
'body' => 'This is the body'
],
'sound' => 'default',
'badge' => 1
],
'headers' => [
'apns-topic' => 'com.mycompany.myapp'
]
])
->setDevicesToken(['deviceToken1','deviceToken2','deviceToken3'...]);
Maybe for iOS 13+ this is better (not tested):
'headers' => [
'apns-push-type' => 'alert'
]