Skip to content

Loading…

Invalid Apple DeviceToken Raises Exception #65

Closed
eduardoalmeida opened this Issue · 1 comment

2 participants

@eduardoalmeida

If, for some reason, there is an error in the device token(not a HEX character) the code throws an Exception that is not handled in this line:

deviceToken[i] = byte.Parse(DeviceToken.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber);

of the AppleNotification.cs. Line 108 of my file.

Changed the line to:

for (int i = 0; i < deviceToken.Length; i++)
            {
                try
                {
                    deviceToken[i] = byte.Parse(DeviceToken.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber);
                }
                catch (Exception ex)
                {
                    throw new NotificationFailureException(8, this);
                }
            }

fixed the issue. Used errorCode 8 as its message is invalid token.

@Redth
Owner

Good idea, will add it in, thanks :)

@Redth Redth added a commit that closed this issue
@Redth Fixes #65
Also bumped versioning
f66296b
@Redth Redth closed this in f66296b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.