0
ギャラリーから複数の画像を選択していますが、これらの画像をWebサービスに投稿する必要がありますが、1つの画像しか投稿できない問題があります。この問題を解決するのに役立ちます。 ありがとう....ここ画像の配列に問題がありました
は私のコード
-(void)callingUploadBusinessBussinessGalleryImageApi{
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);
[arrImgData insertObject:uploadImageData atIndex:i];
}
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:arrImgData];
//NSData *data =[NSPropertyListSerialization dataWithPropertyList:arrImgData format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];
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];
[networkHandler startUploadRequest:@"DirectoryProfilePhoto" withData:data withType:fileTypeJPGImage withUrlParameter:uploadBusinessGalleryImageUrl withFileLocation:@"imageFile" SuccessBlock:^(id responseObject) {
NSLog(@"%@", responseObject);
} ProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
} FailureBlock:^(NSString *errorDescription, id errorResponse) {
}];
}
は、ここで私は画像の配列を送信する必要があるサーバへの単一の画像のみの投稿です...
私の質問はここで私は一つだけの画像を投稿することができ、画像 – ammu
のアップロード配列であるが、O ahve – ammu
は、その後、あなたのアップロードのコードを変更し、AFのネットワークを使用する必要があります画像の配列を投稿します。 これを次のように使用してください:https://stackoverflow.com/a/18204164/6597313 –