2016-12-21 2 views
0

2011 년에 처음으로 만들어진 2011 년 목표 및 iOS 응용 프로그램에서 일하고 있습니다. 2013 년에 일부 업데이트와 변경이있었습니다. 지금은 오류 : 나 체크인 AppDelegate에있는실행 후 오래된 iOS 응용 프로그램이 충돌 함

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'

:

[self.window setRootViewController:viewAfterLaunchScreen]; 

후 디버깅이 응답 "Application windows are expected to have a root view controller at the end of application launch" error when running a project with Xcode 7, iOS 9

에 따른 난 애플리 것을 발견했다 viewWillAppear에서 rootViewController를 실행 한 후 양각 오류가 발생합니다.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 
if ([[DAL GetPreferences:@"FIRST"] isEqualToString:@"1"]) 
{ 
    LoginViewController *lvc3 = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; 
    [self.window setRootViewController:lvc3]; 
    [lvc3 release]; 
} 
else if(_window.rootViewController == nil){ 

    PagingViewController *lvc2 = [[PagingViewController alloc] initWithNibName:@"PagingViewController" bundle:nil]; 
    [self.window setRootViewController:lvc2]; 
    [lvc2 release]; 
} 
[DAL SavePreference:@"FIRST" :@"1"]; 
[self.window makeKeyAndVisible]; 
return YES; } 
+1

가능한 복제가에서 루트 뷰 컨트롤러가 예상된다

[window setRootViewController:viewController]; 
응용 프로그램 실행 끝 "Xcode 7, iOS 9 함께 프로젝트를 실행할 때 오류 (http://stackoverflow.com/questions/30884896/application-windows-are-expected-to-have-a-root-view-controller- at-the-end-of-a) – Mahesh

+0

@Mahesh 내 질문을 게시하기 전에이 대답을 확인했으며 이미 setRootViewController를 확인했다고 언급했습니다. –

+0

'didFinishLaunchingWithOptions' 메소드를 보여주세요. – Mahesh

답변

0

이 "오래된"프로젝트는 몇 살입니까? 그것이 몇 년 이상이라면 당신은 여전히합니까 :

[window addSubview:viewController.view]; 

대신으로 교체해야합니다

[ "응용 프로그램 창
관련 문제