NSData与其它类型的转换
NSString转换成NSData对象
NSData *xmlData = [@"testdata" dataUsingEncoding:NSUTF8StringEncoding];
NSData转换成NSString对象
NSData *data;
NSString *result = [NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSData转换成Char*
NSData *data;
char *test = [data bytes];
Char*转换成NSData
byte *tempData = malloc(sizeof(byte)*16);
NSData *content = [NSData dataWithBytes:tempData length:16];