//NSData轉換為UIImage
NSData *imageData = [NSData dataWithContentsOfFile: imagePath];
UIImage *image = [UIImage imageWithData: imageData];
//UIImage轉換為NSData
NSData *imageData = UIImagePNGRepresentation(aimae);
1. 字符串轉Data
NSString * str =@"str";
NSData *data =[str dataUsingEncoding:NSUTF8StringEncoding];
2.NSData 轉NSString
NSString * str =[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
3.data 轉char
NSData *data;
char * haha=[data bytes];
4. char 轉data
byte * byteData = malloc(sizeof(byte)*16);
NSData *content=[NSData dataWithBytes:byteData length:16];