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

iOS push not working for device tokens when spaces removed #212

Closed
djangojack opened this Issue Oct 8, 2015 · 7 comments

Comments

Projects
None yet
2 participants
@djangojack

When I register, I get the normal response:

Push Plugin register success: <502c9fd8 57dfe2d4 b9fe178b a9690b2e a906f36a 94aabf36 caf9c337 ca56656d> 502c9fd857dfe2d4b9fe178ba9690b2ea906f36a94aabf36caf9c337ca56656d

Pushes fail whenever I try to push to the device token without spaces. Pushes go through perfectly whenever I push to the token with spaces.

To make notifications work, I had to remove the following from https://github.com/phonegap/phonegap-plugin-push/blob/7052c9ce5d3b744fabaaf402bfaafe32b25736c1/src/ios/PushPlugin.m.
'stringByReplacingOccurrencesOfString: @" " withString: @""]'

Is there a reason spaces are removed from the token?

@macdonst

This comment has been minimized.

Show comment
Hide comment
@macdonst

macdonst Oct 8, 2015

Member

@djangojack how are you pushing the info to the device? I've never had a problem with there being no spaces in the ID.

Member

macdonst commented Oct 8, 2015

@djangojack how are you pushing the info to the device? I've never had a problem with there being no spaces in the ID.

@djangojack

This comment has been minimized.

Show comment
Hide comment
@djangojack

djangojack Oct 8, 2015

@macdonst I am using ionic's new push notification service. Ionic gives the option to push by device token.

@macdonst I am using ionic's new push notification service. Ionic gives the option to push by device token.

@macdonst

This comment has been minimized.

Show comment
Hide comment
@macdonst

macdonst Oct 8, 2015

Member

@djangojack Hmmm, that might be a problem with the way they require the device token to be formatted. I'll bring it up to Eric.

Member

macdonst commented Oct 8, 2015

@djangojack Hmmm, that might be a problem with the way they require the device token to be formatted. I'll bring it up to Eric.

@djangojack

This comment has been minimized.

Show comment
Hide comment
@djangojack

djangojack Oct 8, 2015

@macdonst I talked with Ionic & they don't have any idea whats happening.

Do you think there is any problem with me leaving spaces in the device tokens? Is it just a formatting convention to remove them?

@macdonst I talked with Ionic & they don't have any idea whats happening.

Do you think there is any problem with me leaving spaces in the device tokens? Is it just a formatting convention to remove them?

@macdonst

This comment has been minimized.

Show comment
Hide comment
@macdonst

macdonst Oct 8, 2015

Member

@djangojack right, well I talked to Eric. He doesn't see any reason why it shouldn't work either. I use AWS to push to iOS, never use the spaces and it just works.

Member

macdonst commented Oct 8, 2015

@djangojack right, well I talked to Eric. He doesn't see any reason why it shouldn't work either. I use AWS to push to iOS, never use the spaces and it just works.

@djangojack djangojack closed this Oct 9, 2015

@djangojack

This comment has been minimized.

Show comment
Hide comment
@djangojack

djangojack Oct 9, 2015

@macdonst resolved. This was caused by unregistering & re-registering tokens. Ionic is expediting un-registering a token by keeping track of them on their end, but tokens were not being re-registered. My iOS token was identical each time (unlike android), so it would fail after a single login/logout loop. Tokens with spaces worked because APNs doesn't care about spaces, and the token wasn't in ionic's list of unregistered tokens, so Ionic didn't block it. It was an anonymous token, which they allow.

@macdonst resolved. This was caused by unregistering & re-registering tokens. Ionic is expediting un-registering a token by keeping track of them on their end, but tokens were not being re-registered. My iOS token was identical each time (unlike android), so it would fail after a single login/logout loop. Tokens with spaces worked because APNs doesn't care about spaces, and the token wasn't in ionic's list of unregistered tokens, so Ionic didn't block it. It was an anonymous token, which they allow.

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot Jun 5, 2018

This thread has been automatically locked.

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.