Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

    }

    }];
}];

}