1
unsigned char *ImgBytes = [ImgBytes stringByAppendingString:getStringForImage:imageView.image];
Fehler Bad Empfängertyp Unsigned charConvert Bild Bytes in Objective c
unsigned char *ImgBytes = [ImgBytes stringByAppendingString:getStringForImage:imageView.image];
Fehler Bad Empfängertyp Unsigned charConvert Bild Bytes in Objective c
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");
}
}
prüfen diese http://stackoverflow.com/questions/7289150/uiimage-to-byte-array – kb920
Mögliche Duplikat [UIImage to Byte-Array] (http://stackoverflow.com/questions/7289150/uiimage-to-byte-array) –