Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined index: headers #147

Open
ankitindianic opened this issue Oct 13, 2021 · 7 comments
Open

Undefined index: headers #147

ankitindianic opened this issue Oct 13, 2021 · 7 comments

Comments

@ankitindianic
Copy link

ankitindianic commented Oct 13, 2021

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 **

@ankitindianic ankitindianic changed the title Undefined index: headersFile Undefined index: headers Oct 13, 2021
@hammad-pitafi
Copy link

Same issue, if some one has fixed it plz lemme know.Thanks

1 similar comment
@darshantank1995
Copy link

Same issue, if some one has fixed it plz lemme know.Thanks

@usmanjdn93
Copy link

any update on this issue...

@darshantank1995
Copy link

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

@usmanjdn93
Copy link

usmanjdn93 commented Oct 26, 2021

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

@kreitje
Copy link

kreitje commented Jan 4, 2022

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'...]);

@tumispro
Copy link

Maybe for iOS 13+ this is better (not tested):

'headers' => [
    'apns-push-type' => 'alert'
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants