@implementation loadingViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// send request
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection{
//inserting the response Data in database
[self performSegueWithIdentifier:@"loadingMenuSegue" sender:self];
}
@end
我有这个错误
* 断言失败 - [UIWindowController转换:fromViewController:toViewController:target:didEndSelector:],/ SourceCache / UIKit_Sim / UIKit-1914.84 /UIWindowController.m:188
* 由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'尝试在转换已经进行时开始模式转换。等待viewDidAppear / viewDidDisappear知道当前转换已完成'
答案 0 :(得分:3)
@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 :(得分:1)
该错误可能表示您在connectionDidFinishLoading:
之前调用了viewDidAppear:
方法。由于此时无法执行segue,您可能希望在ivar或属性中保持某种状态(以便知道连接已完成),然后在viewDidAppear:
实现中可以测试该状态并在需要时执行segue。