Qanah
Qanah

Reputation: 41

error when i performSegueWithIdentifier

@implementation loadingViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // send request
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection{

//inserting the response Data in database

[self performSegueWithIdentifier:@"loadingMenuSegue" sender:self];

}

@end

i have this error

* Assertion failure in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:], /SourceCache/UIKit_Sim/UIKit-1914.84/UIWindowController.m:188

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a modal transition from to while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'

Upvotes: 1

Views: 1154

Answers (2)

Qanah
Qanah

Reputation: 41

@implementation loadingViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // send request
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection{

//inserting the response Data in database

//remove perform Segue from her, because the process is not finish yet
// [self performSegueWithIdentifier:@"loadingMenuSegue" sender:self];

}

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    [self performSegueWithIdentifier:@"loadingMenuSegue" sender:self];
}

@end

Upvotes: 3

rickster
rickster

Reputation: 126157

That error likely indicates that your connectionDidFinishLoading: method is being called before viewDidAppear:. Since you can't perform a segue at that point, you might want to hold onto some state (so that you know the connection is finished) in an ivar or property, then in your viewDidAppear: implementation you can test that state and perform the segue if needed.

Upvotes: 1

Related Questions