unsigned char *ImgBytes = [ImgBytes stringByAppendingString:getStringForImage:imageView.image];
错误Bad Receiver Type Unsigned char
答案 0 :(得分:0)
NSString *ImgBytes;
ImgBytes=[ImgBytes stringByAppendingString:[self getStringForImage:imageView.image]];
ImgBytes=[ImgBytes stringByAppendingString:[NSString stringWithFormat:@"^%@",q]];
-(NSString*)getStringForImage:(UIImage*)img
{
@try {
NSData *data = UIImagePNGRepresentation(img);
NSUInteger len = data.length;
uint8_t bytes = (uint8_t )[data bytes];
NSMutableString *result = [NSMutableString stringWithCapacity:len];
for (NSUInteger i = 0; i < len; i++) {
if (i) {
[result appendString:@","];
}
[result appendFormat:@"%d",bytes];
}
return result;
} @catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
NSLog(@"finally");
}
}