-
Application windows are expected to have a root view controller at the end of application launchProgramming/iOS SDK 2016. 3. 12. 21:59반응형
2010년에 만들었던 앱 소스를 6년만에 열어보니 수많은 워닝과 오류들이 뜹니다.
그리고 너무도 낯설게 느껴지는 Obj-C 구문
일단 워닝들은 모두 무시하고 오류들만 하나 하나 수정하고 어찌어찌 하니 생각보다 간단하게 빌드까지 성공했습니다.
그리고는 시뮬레이터에서 실행.
실행과 동시에 사망
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
0 CoreFoundation 0x00000001034abe65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000102f24deb objc_exception_throw + 48
2 CoreFoundation 0x00000001034abcca +[NSException raise:format:arguments:] + 106
3 Foundation 0x00000001005ac4de -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 UIKit 0x000000010097f218 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3122
5 UIKit 0x000000010097be7b -[UIApplication workspaceDidEndTransaction:] + 188
6 FrontBoardServices 0x0000000104bd1754 -[FBSSerialQueue _performNext] + 192
7 FrontBoardServices 0x0000000104bd1ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
8 CoreFoundation 0x00000001033d7a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
9 CoreFoundation 0x00000001033cd95c __CFRunLoopDoSources0 + 556
10 CoreFoundation 0x00000001033cce13 __CFRunLoopRun + 867
11 CoreFoundation 0x00000001033cc828 CFRunLoopRunSpecific + 488
12 UIKit 0x000000010097b7cd -[UIApplication _run] + 402
13 UIKit 0x0000000100980610 UIApplicationMain + 171
* 해결방법
기존 [window addSubview:...] 를 [window setRootViewController:...] 로 교체
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { rootVC = [rootViewController alloc]; // [window addSubview:rootVC.view]; [window setRootViewController:rootVC]; return TRUE; }
반응형'Programming > iOS SDK' 카테고리의 다른 글
NSLineBreakMode (0) 2017.02.11 [iOS SDK] 이어폰(헤드셋) 연결상태 확인 예제 (2) 2011.06.29 Xcode4 - iOS 도움말(developer library reference) Organizer에 추가하기 (0) 2011.04.13