I have a bunch of tags that are URL tags that have the content "http://WEBSITE.com". Let's say WEBSITE is youtube so http://youtube.com. When I scan them on Android etc, it keeps the http or https.
I'm trying to scan these same tags using the Core NFC framework. I scan them and I get a bunch of bytes that I convert using NSSString initWithData with UTF8 Encoding. I get back \^Cyoutube.com. I want to get http://youtube.com.
How can I interept the payload to get what I need? If I'm to assume the http in front of the string, how am I supposed to know if it is http or https or even ftp?
Edit 1:
I'm having issues with the below answer code for pure text records. When making a text record for "hello world" I get the following outputs from the console:
2017-06-09 12:45:35.151806-0400 testNFC[2963:190724] Payload string:https://www.enhello world
2017-06-09 12:45:35.154959-0400 testNFC[2963:190724] Payload data:<02656e68 656c6c6f 20776f72 6c64>
To get the string I use
NSString *nfcMessage = [nfcType stringByAppendingString:[[[NSString alloc] initWithData:payload.payload encoding:NSUTF8StringEncoding] substringFromIndex:1]];
nfcType is the return from your function but for the None case I return @"";
I'm expecting to just get hello world.