ios - How to upload hundreds of pictures by AFNetworking? -
i upload pictures, ranging few hundred 1000, using afnetwoking methods, there drawback, reads image data 1 time, memory up,for example:
nsoperationqueue *operationqueue = [[nsoperationqueue alloc]init]; [operationqueue setmaxconcurrentoperationcount:1]; (nsurl *fileurl in filestoupload) { nsurlrequest *request = [[afhttprequestserializer serializer] multipartformrequestwithmethod:@"post" urlstring:@"http://example.com/upload" parameters:nil constructingbodywithblock:^(id<afmultipartformdata> formdata) { [formdata appendpartwithfileurl:fileurl name:@"images[]" error:nil]; }]; afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; [operationqueue addoperation:operation]; }
this read pictures's data before upload, how can create queue reduced memory consumption
Comments
Post a Comment