Upload multiple images using AFNetworking

前端 未结 5 972
别跟我提以往
别跟我提以往 2020-12-19 12:30

I used the PickerController and loaded a few images on to a NSMutableArray.

Now i need to upload all of these images at once. am using

5条回答
  •  失恋的感觉
    2020-12-19 13:18

    Common technique for turning a UIImage into NSData is with one of the following two methods.

    NSData *pngData = UIImagePNGRepresentation(myUIImage);
    CGFloat quality = 1.0; // ranges from 0 to 1, 0% to 100%
    NSData *jpgData = UIImageJPEGRepresentation(myUIImage, quality);
    

    This of course assumes you know which type your image is. But since you used a PickerController to fetch the images, then it should be fairly easy to determine this. You just pull out the value under the key UIImagePickerControllerReferenceURL and check the ext parameter. This comment shows it visually https://stackoverflow.com/a/11506499/1529638.

提交回复
热议问题