UIImage to byte array
问题 I'm creating an app that uploads an image to a server. It must send the byte array on a XML. How do I get the byte array into a NSString? Thanks! 回答1: You can convert the UIImage to a NSData object and then extract the byte array from there. Here is some sample code: UIImage *image = [UIImage imageNamed:@"image.png"]; NSString *byteArray = [UIImagePNGRepresentation(image) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; If you are using a PNG Image you can use the