Byte *bytes=(Byte*)[data bytes];
NSString *hexStr=@"";
for(int i=0;i<[data length];i++)
{
NSString *newHexStr=[NSString stringWithFormat:@"%x",bytes[i]&0xff];///16进制数
if([newHexStr length]==1)
hexStr=[NSString stringWithFormat:@"%@0%@",hexStr,newHexStr];
else
hexStr=[NSString stringWithFormat:@"%@%@",hexStr,newHexStr];
}
NSLog(@"bytes的16进制数为:%@",hexStr);
NSData转化成十六进制字符串,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/clumsy1006/p/3782084.html