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

Push token: replace NSData.description usage #889

Closed
ricardopereira opened this issue Sep 10, 2019 · 0 comments · Fixed by #893
Closed

Push token: replace NSData.description usage #889

ricardopereira opened this issue Sep 10, 2019 · 0 comments · Fixed by #893
Labels
bug Something isn't working. It's clear that this does need to be fixed.

Comments

@ricardopereira
Copy link
Contributor

ricardopereira commented Sep 10, 2019

-[NSData description] is not a good way to stringify push tokens and the follow code will break in iOS 13:

NSString *deviceToken = [[[deviceTokenData description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] stringByReplacingOccurrencesOfString:@" " withString:@""];

Replace with something like:

const unsigned char *dataBuffer = data.bytes;
NSMutableString *hexString  = [NSMutableString stringWithCapacity:(dataLength * 2)];
for (int i = 0; i < dataLength; ++i) {
    [hexString appendFormat:@"%02x", dataBuffer[i]];
}

NSLog(@"%@", [hexString copy]);

More info about this: https://stackoverflow.com/a/57842886/3641812

@ricardopereira ricardopereira added the bug Something isn't working. It's clear that this does need to be fixed. label Sep 12, 2019
ricardopereira added a commit that referenced this issue Sep 17, 2019
ricardopereira added a commit that referenced this issue Oct 3, 2019
Squashed:
 - TestSuite: MockDeviceStorage should store values that were written
 - Test for #889: should store the device token data as string
 - Fix #889: NSData.description is not a good way to stringify device tokens and it will break in iOS 13
 - Test suite: fix intermittent failure of "ARTPushRegistererDelegate must be implemented"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. It's clear that this does need to be fixed.
Development

Successfully merging a pull request may close this issue.

1 participant