1. 字符串转Data
NSString * str =@"zifuchuanzhuandata";
NSData *data =[zifuchuanzhuandata dataUsingEncoding:NSUTF8StringEncoding];
2.NSData 转NSString
NSString * dataToString =[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
1. 字符串转Data
NSString * str =@"zifuchuanzhuandata";
NSData *data =[zifuchuanzhuandata dataUsingEncoding:NSUTF8StringEncoding];
2.NSData 转NSString
NSString * dataToString =[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];