Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

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

Closed
lbickston opened this issue Oct 8, 2015 · 7 comments
Closed

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

lbickston opened this issue Oct 8, 2015 · 7 comments

Comments

@lbickston
Copy link

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
Copy link
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.

@lbickston
Copy link
Author

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

@macdonst
Copy link
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.

@lbickston
Copy link
Author

@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
Copy link
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.

@lbickston
Copy link
Author

@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
Copy link

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.
Labels
None yet
Development

No branches or pull requests

2 participants