我正在创建一个应用程序,让用户可以发布到他们的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语句不起作用?
任何帮助都将不胜感激。