1
votes
@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'

2

2 Answers

3
votes
@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
1
votes

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.