I am sending NSString
and UIImage
using bluetooth. I decided to store both in a NSDictionary
and then convert the dictionary to NSData
.
My question is how to convert NSDictionary
to NSData
and visa versa?
NSDictionary -> NSData:
NSData *myData = [NSKeyedArchiver archivedDataWithRootObject:myDictionary];
NSData -> NSDictionary:
NSDictionary *myDictionary = (NSDictionary*) [NSKeyedUnarchiver unarchiveObjectWithData:myData];