错误不是每次。我曾尝试清理和重建应用程序,但它也是。
错误:
*** Assertion failure in -[UIWindowController
transition:fromViewController:toViewController:target:didEndSelector:],
/SourceCache/UIKit_Sim/UIKit-2372/UIWindowController.m:211
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Attempting to begin a modal transition from
<UINavigationController: 0x9190730> to <UINavigationController: 0x83a9dc0>
while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear
to know the current transition has completed'
*** First throw call stack:
(0x213d012 0x1e85e7e 0x213ce78 0x191bf35 0x10b8d05 0xeb74f3 0xeb7777 0x10be033f
0xeb77b7 0x104f0 0x1e996b0 0x18c6035 0x20c0f3f 0x20c096f 0x20e3734 0x20e2f44
0x20e2e1b 0x36437e3 0x3643668 0xdcd65c 0x1133f2 0x25c5)
libc++abi.dylib: terminate called throwing an exception
BaseController.h:
@class LoginViewController;
@interface BaseController:UIViewController
//...
@end
基本控制器.m
@implement BaseController
//...
-(void)showLoginForm
{
UIViewController* loginx =(UIViewController*) [[LoginViewController alloc] init];
UINavigationController* navx = [[UINavigationController alloc] initWithRootViewController:loginx];
[navx.navigationBar setBackgroundImage:[UIImage imageNamed:@"title_bar.png"] forBarMetrics:UIBarMetricsDefault];
//added
//i can use @try to catch it
[self presentModalViewController:navx animated:YES];//<====it is error
[loginx release];
[navx release];
}
登录视图控制器:
@interface LoginViewController:BaseController
//...
@end
otherViewController:我会判断用户是否登录在这个控制器中。如果没有登录,我会调用showLoginForm
//@interface otherViewController:BaseController
//......
-(void)viewDidLoad
{
//make a thread to call isLogin
}
-(void)isLogin
{
BOOL logined = YES;
//......
if(!logined)//i take this on MainThread,it has error also.
[super showLoginForm];
}
MainViewController:(显示otherViewController是Main ViewController)
//@interface MainViewController:BaseController
//......
-(void)buttonAction
{
otherViewController* other = [[otherViewController alloc] init];
UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:other];
[self presentModalViewController:navigation animated:YES];
//release
}
所以,谁知道这是怎么回事?