Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Shawn McGrory
Shawn McGrory
546 Points

Console warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress

"Warning: Attempt to dismiss from view controller <UITabBarController: 0xbab41b0> while a presentation or dismiss is in progress!"

I'm trying to have my app go to a loading screen upon selecting a picture to upload. This works by, upon selecting a picture, removing the UIImagePickerController scene, adding the Loading scene, and once the upload is complete, removing the Loading scene.

-(void)uploadMessage{

[self dismissViewControllerAnimated:NO completion:nil];


LoadingViewController *loadView = [[LoadingViewController alloc]initWithNibName:@"LoadView" bundle:nil];

    [self presentViewController:loadView animated:NO completion:^{

    NSData *fileData;
    NSString *fileName;
    NSLog(@"Image");
    fileData = UIImagePNGRepresentation(self.image);
    fileName = @"image.png";


PFFile *file = [PFFile fileWithName:fileName data:fileData];
[self.game setObject:file forKey:@"picture"];
[self.game saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if(succeeded){
     [self removeAndChangeButtons];
        [self dismissViewControllerAnimated:NO completion:nil];

    }

    }];
}];

}