我想從我的應用程序上傳多個圖像。Facebook多個圖像上傳
我會有圖像陣列,我正在使用此代碼上傳所有圖像。但是,如果圖片更多,上傳我的用戶界面會被阻止。所以,請建議我如何開始上傳背景或建議我的另一種方法..
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD.labelText = @"Uploading Images";
[self.view addSubview:HUD];
[HUD show:YES];
NSMutableArray *aryFetchedImages = [self fetchPhotosForAlbum];
for (int i = 0; i < aryFetchedImages.count ; i++) {
NSLog(@"img%d",i);
[params setObject:@" " forKey:@"message"];
[params setObject:UIImageJPEGRepresentation([aryFetchedImages objectAtIndex:i], 50.0f) forKey:@"picture"];
[FBRequestConnection startWithGraphPath:@"me/photos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (error)
{
//showing an alert for failure
#ifdef DEBUG
NSLog(@"Unable to share the photo please try later - Fail %@",error);
#endif
}
else
{
//showing an alert for success
#ifdef DEBUG
NSLog(@"Photo %@ uploaded on Facebook Successfully",UIImageJPEGRepresentation([aryFetchedImages objectAtIndex:i], 50.0f));
#endif
}
}];
}
[HUD show:NO];
[HUD removeFromSuperview];