1
@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 transition:fromViewController:toViewController:target:didEndSelector:], /SourceCache/UIKit_Sim/UIKit-1914.84/UIWindowController.m:188

*由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“尝试在转换已经在进行时从 to 开始模态转换。等待 viewDidAppear/viewDidDisappear 知道当前转换已经完成'

4

2 回答 2

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
于 2012-06-17T15:51:49.220 回答
1

该错误可能表明您的connectionDidFinishLoading:方法之前被调用过viewDidAppear:。由于此时您无法执行转场,因此您可能希望在 ivar 或属性中保持某种状态(以便您知道连接已完成),然后在您的viewDidAppear:实现中,您可以测试该状态并在以下情况下执行转场需要。

于 2012-06-17T05:52:31.650 回答