I've been trying to convert a user defaults NSString (tried NSData also), into a hex value I can use with char array. the problem is that every time I convert it from the NSString or NSData it takes the hex values and turns them into ASCII values, which isn't what I want at all. how to I tell it to literally take the values that are there and keep them hex? I'm struggling to find a solution.
inside my .plist
<key>shit</key>
<string>5448495344414e475448494e474e45454453544f53544159484558</string>
my code to convert the NSString to NSData
NSString *defaults = [[NSUserDefaults standardUserDefaults] objectForKey:@"shit"];
NSData *theData = [defaults dataUsingEncoding:NSUTF8StringEncoding];
NSUInteger dataLength = [theData length];
Byte *byteData = (Byte*)malloc(dataLength);
memcpy(byteData, [theData bytes], len);
NSLog(@"THIS : %@",[NSData dataWithBytes:byteData length:len]);
output:
THIS : <35343438 34393533 34343431 34653437 35343438 34393465 34373465 34353435 34343533 35343466 35333534 34>len
why in the world is it doing this? I want the original hex values, not interpretation of my hex values.