0

I am making an app that lets users post to their Flickr photo streams. I am using ObjectiveFlickr to handle the authorization and posting process.

For posting a single picture i am using the following code:

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;
        }

This works just fine. However, when i try to post multiple pics that i stored in a NSMutableArray, ObjectiveFlickr uploads only the first picture.

My code for posting multiple photos looks like this:

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;

Does anyone have an idea why the for-in statement doesn't work?

Any help would be appreciated.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Granit
  • 1,261
  • 6
  • 19
  • 35
  • What is/isn't happening? Sprinkle some logs in there... is picsToPost nil? etc.. – Mick MacCallum Nov 18 '13 at 13:23
  • When i set a breakpoint on the line of picsToPost it says that there are 2 objects (i selected 2 pictures). It only posts the first element of the array. – Granit Nov 18 '13 at 13:26

0 Answers0