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

Not Able to send push notification #76

Open
sukritisuku opened this issue Nov 18, 2019 · 10 comments
Open

Not Able to send push notification #76

sukritisuku opened this issue Nov 18, 2019 · 10 comments

Comments

@sukritisuku
Copy link

Hi,

I am not able to send push notification any more from Pusher Mac app. It was showing Notification error: APN invalid Token. please give the solution for the issue

@mroffmix
Copy link

Hi, if you are on ios 13 you can try to format your token using this line of code.

let deviceToken = credentials.token.map { String(format: "%02x", $0) }.joined()

@sukritisuku
Copy link
Author

hi
i am not using iOS 13. I am on iOS 12. still not able to get push.

Error = "Notification error: APN invalid Token"

@dhruvil1514
Copy link

Same issue I am also facing

@saormart
Copy link

iOS 13
MacOS Catalina
Xcode 11.3.1

For me is working fine from Mac OS or iOS on iPhones / iPads!
Great project! Thanks !

@brunomunizaf
Copy link

on didRegisterForRemoteNotificationsWithDeviceToken do:

let tokenParts = deviceToken.map { data -> String in
    return String(format: "%02.2hhx", data)
}

let token = tokenParts.joined()

@enasaz9
Copy link

enasaz9 commented Aug 4, 2020

@brunomunizaf Not working with me.
any update?

@brunomunizaf
Copy link

@brunomunizaf Not working with me.

any update?

Nope. Just gave up... alternatively used a script. Been a while - i probably lost it already. Will look into it

@enasaz9
Copy link

enasaz9 commented Aug 4, 2020

@brunomunizaf thank you so much, please share this script with me if possible, your help is highly appreciated :)

@brunomunizaf
Copy link

@enasaz9 try this out https://github.com/tsif/pu.sh/blob/master/pu.sh worked for me.

@pacocd
Copy link

pacocd commented Dec 8, 2020

In case APN invalid Token appears, make sure that you are using correct environment and proper extraction of token.
1.- Should use sandbox environment enabled works for devices using debug mode.
2.- On recent iOS versions, the way to get device string tokens has been updated due to changes in Data class deviceToken.reduce("", { $0 + String(format: "%02.2hhx", $1) }) (I am not sure at all if this changed on iOS 12 or 13)

Hope this can help you :)

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

7 participants