0

I need to post the array of images in a single request..... but i don't know how to do that in a single request by using AFNetworking here is my code:

-(void)callingUploadBusinessBusinessGalleryImageApi{

    BusinessUser *busUser = [BusinessUser getBusinessUser];
    NSMutableArray *arrImgData = [[NSMutableArray alloc] init];

    for (int i = 0; i < self.chosenImages.count; i++) {
       uploadImageData = UIImageJPEGRepresentation([self.chosenImages objectAtIndex:i], 0.1); 
   
    NSURL *uploadProfPicUrl = [NSURL URLWithString:BaseUrl];
    NSMutableDictionary *dataDictionary = [[NSMutableDictionary alloc] init];
    [dataDictionary setValue:[NSNumber numberWithLong:busUser.business_id] forKey:@"business_id"];
    NetworkHandler *networkHandler = [[NetworkHandler alloc] initWithRequestUrl:uploadProfPicUrl withBody:dataDictionary withMethodType:HTTPMethodPOST withHeaderFeild:nil];
  NSString *businessid =[dataDictionary valueForKey:@"business_id"];
    NSString*Urlparameter= [NSString stringWithFormat:@"%@/%@", uploadBusinessGalleryImageUrl, businessid];
    NSLog(@"%@", Urlparameter);

    [networkHandler startUploadRequest:@"" withData:uploadImageData  withType:FiletypeZip withUrlParameter:Urlparameter withFileLocation:@"imageFile" SuccessBlock:^(id responseObject) {
        NSLog(@"%@responseObject", responseObject);
    } ProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {

    } FailureBlock:^(NSString *errorDescription, id errorResponse) {

    }];
}

please help me to solve this issues.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
ammu
  • 27
  • 7

0 Answers0