Last active
October 1, 2019 12:49
Extension method to convert NSData into string representation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Use this extension method to get the hex string from NSData, I use this to get the push notification token in iOS >= 13 | |
public static string HexadecimalStringFromData(this NSData data) | |
{ | |
nuint dataLength = data.Length; | |
if (dataLength == 0) | |
{ | |
return null; | |
} | |
return string.Join(string.Empty, data.Select(b => b.ToString("X2")).ToList()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment