// 字符串转成ASCII后转成16进制
- (NSString *) NSStringToASCIINSString:(NSString *)str1{
NSString *str4 = nil;
NSMutableString *strlast = [[NSMutableString alloc]init];
for(int i = 0; i < [str1 length]; i++){
NSRange range = NSMakeRange(i, 1);
NSString * str2 = [str1 substringWithRange:range];
int asciiCode = [str2 characterAtIndex:0];
NSString *str3 = [NSString stringWithFormat:@"%@",[[NSString alloc] initWithFormat:@"%1x",asciiCode]];
[strlast appendString:str3];
str4 = strlast;
}
NSLog(@"str4 = %@",str4);
return str4;
}