NSString 轉(zhuǎn) NSData
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
NSData 轉(zhuǎn) NSString
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
Struct轉(zhuǎn)NSData
NSData *data = [NSData dataWithBytes:&struct length:sizeof(struct)];