NSData to text conversion

In an iOS App, I receive a push token for notifications from APN in the following Text format;
{length = 32, bytes = 0x7ea619b7 9285424b f62a8e04 30bd94e3 … 8505c98a 9305909a }
(The actual string is longer, but I’m sure you get the idea)

What I need to create is an alphanumeric text of 32 characters from this text.

Can anyone help me how to convert the text I receive to an actual 32 character text?

Are you using iOSKit?

Yes, I am. Does that have the function I need?

I believe it does.


// theData is the NSData object your mentioned in your first post Dim mb As Xojo.core.Memoryblock = theData.GetBytes(theData.length) Dim token As Text = Xojo.Core.TextEncoding.UTF8.ConvertDataToText(mb)

@Jeremie Leroy : Thanks for the hint. I ended up with the following, that finally got me to receive a remote notification on my Apple Watch :slight_smile:

[code]dim mb as Xojo.Core.MemoryBlock = deviceToken.GetBytes(tokenLength)

var joiner() as Text
for i as integer=0 to mb.Size-1
var b as UInt8=mb.UInt8Value(i)