충돌이 있습니다. 다른 스레드와 비슷하지만 같지 않습니다. 먼저 사용자가 특정보기 컨트롤러로 이동하는 모달보기 컨트롤러를 보여주고 싶습니다. 힌트 다음에, 나는 그것을한다. - (무효) viewDidAppear : (BOOL) 애니메이션을 적용하고 추천 된대로 지연을 적용한다.충돌이있는 모달 뷰 컨트롤러
- (void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self performSelector:@selector(presentMyModal) withObject:nil afterDelay:1];
}
- (void) presentModal{
ModalViewController *modal = [[[ModalViewController alloc] init] autorelease];
[self presentModalViewController:modal animated:YES];
}
나중에, 람직하게 충돌합니다. 콘솔에서이 메시지를받습니다.
<Warning>: *** Assertion failure in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:], /SourceCache/UIKit/UIKit-1447.6.4/UIWindowController.m:186
Thu Feb 3 10:00:44 unknown MyApp[1830] <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a modal transition from <UINavigationController: 0x454260> to <ModalViewController: 0x47af00> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'
*** Call stack at first throw:
(
0 CoreFoundation 0x3759dc7b __exceptionPreprocess + 114
1 libobjc.A.dylib 0x32d9bee8 objc_exception_throw + 40
2 CoreFoundation 0x3759dac3 +[NSException raise:format:arguments:] + 70
3 Foundation 0x351a3e73 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 62
4 UIKit 0x359e92a8 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 208
5 UIKit 0x359e8c98 -[UIViewController presentModalViewController:withTransition:] + 2792
6 UIKit 0x35a7b51c -[UIViewController _tryRecursivelyPresentModalViewController:withTransition:] + 116
7 UIKit 0x359e84c0 -[UIViewController presentModalViewController:withTransition:] + 784
8 UIKit 0x359e8060 -[UIViewController presentModalViewController:animated:] + 96
9 MyApp 0x0005d57f -[MyAppViewController presentMyModal] + 58
10 Foundation 0x351724db __NSFireDelayedPerform + 366
11 CoreFoundation 0x37552305 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 16
12 CoreFoundation 0x37551cd9 __CFRunLoopDoTimer + 988
13 CoreFoundation 0x37521a91 __CFRunLoopRun + 1184
14 CoreFoundation 0x3752150b CFRunLoopRunSpecific + 226
15 CoreFoundation 0x37521419 CFRunLoopRunInMode + 60
16 GraphicsServices 0x33e76d24 GSEventRunModal + 196
17 UIKit 0x3591d57c -[UIApplication _run] + 588
18 UIKit 0x3591a558 UIApplicationMain + 972
19 MyApp 0x0000e75f main + 50
20 MyApp 0x0000e6e8 start + 52
볼 수 있듯이, 나는보기가 나타날 때까지 기다립니다. OS 버그일까요? 재귀 적으로 다른 모달보기 컨트롤러를 제시하려고 시도하는 것처럼 보이고, provoquing 충돌이 발생합니다. 고마워요.
그냥 다른 뷰를 보여주는 대신에 바로 ModalViewController를 보여줄까요? – willcodejavaforfood
답변 해 주셔서 감사합니다. 가급적이면, 우리는 약간의 견해를 보여주고 싶습니다. 그러나 우리는 그것을 고려할 것입니다. – toupper
@selector (presentMyModal)에 오타가 있습니다 -이 함수는 presentModal입니다. 하지만 여기에 제시하기 전에 코드를 벗겨 냈을 것입니다. 그렇지 않으면 충돌 로그에서 결코 멀리 가지 않을 것입니다 .-) – Mayjak