我正在制作一个应用程序,让用户可以发布到他们的 Flickr 照片流。我正在使用 ObjectiveFlickr 来处理授权和发布过程。
为了发布单张图片,我使用以下代码:
if (isSinglePic) {
UIImage *img = self.singlePic;
NSData *JPEGData = UIImageJPEGRepresentation(img, 1.0);
self.flickrRequest.sessionInfo = __kUploadImageStep;
[self.flickrRequest uploadImageStream:[NSInputStream inputStreamWithData:JPEGData] suggestedFilename:self.descriptionTextField.text MIMEType:@"image/jpeg" arguments:[NSDictionary dictionaryWithObjectsAndKeys:@"0", @"is_public", nil]];
//[NSDictionary dictionaryWithObjectsAndKeys:photoID, @"photo_id", @"PicknPost", @"title", @"via PicknPost", @"description", nil]]
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
这工作得很好。但是,当我尝试发布存储在 NSMutableArray 中的多张图片时,ObjectiveFlickr 仅上传第一张图片。
我发布多张照片的代码如下所示:
NSMutableArray *array = [[NSMutableArray alloc] initWithArray:picsToPost copyItems:YES];
for (UIImage *imgToPost in array) {
NSData *JPEGData = UIImageJPEGRepresentation(imgToPost, 1.0);
self.flickrRequest.sessionInfo = __kUploadImageStep;
[self.flickrRequest uploadImageStream:[NSInputStream inputStreamWithData:JPEGData] suggestedFilename:self.descriptionTextField.text MIMEType:@"image/jpeg" arguments:[NSDictionary dictionaryWithObjectsAndKeys:@"0", @"is_public", nil]];
[UIApplication sharedApplication].idleTimerDisabled = YES;
有谁知道为什么 for-in 语句不起作用?
任何帮助,将不胜感激。