2012-10-22 4 views
0

2012-04-18 12 : 58 : 07.108 MYiPad [12574 : C07] 응용 프로그램을 인해 캐치되지 않는 예외 UIViewControllerHierarchyInconsistency을 종료, 이유 : 보기 만 최대 하나의 뷰와 연관 될 수 있습니다 컨트롤러에서 시간! <보기 UITableView : 0xb0eae00; 프레임 = (0 0; 320 960); clipsToBounds = YES; 자동 크기 조정 = W + H; 제스처 인식기 = < NSArray : 0xac460e0>; layer = < CALayer : 0xac46830>; contentOffset : {-0, -20}> 은 < RootViewController : 0xac20f20>과 관련됩니다. 이보기를 연결하기 전에이 연관을 지우십시오.UIViewControllerHierarchyInconsistency 오류 - 응용 프로그램이 충돌 유지

먼저 던져 호출 스택 : (0x1b57012 0x153ce7e 0x1b56deb 0x4cf309 0x5665ac 0x562a90 0x6b0232 0x4e257 0x21e3f 0x184a8c 0x19c417d 0x1836d2 0xc4c2 0x1aae59 0x1a8f22 0x1aa16a 0x1a8edd 0x1a9055 0xf6338 0x1e64a81 0x1e63d33 0x1ea1e3a 0x1af98fd 0x1ea24bc 0x1ea2435 0x1d8c3a0 0x1adaf3f 0x1ada96f 0x1afd734 0x1afcf44 0x1afce1b 0x24917e3 0x2491668 0x48165c 0x2c8d 0x2bc5을 0x1)의 libC++ abi.dylib : 예외를 던지는라고 종료

* - (무효)의 viewDidLoad {

[self.tableView initWithFrame:self.tableView.frame style:UITableViewStyleGrouped]; 
self.tableView.contentInset = UIEdgeInsetsMake(20.0,0.0,0.0,0.0); 
self.appDelegate = (FCDBiPadAppDelegate *)[[UIApplication sharedApplication] delegate]; 
[self.tableView setBackgroundView:nil]; 
[self.tableView setBackgroundView:[[[UIView alloc] init] autorelease]]; 
[self.tableView setBackgroundColor:[UIColor colorWithRed:217 green:220 blue:225 alpha:0.9]]; 
unsigned int b; 
NSScanner *scanner = [[NSScanner alloc] initWithString:[[[Engine sharedInstance] properties] objectForKey:@"NAVBAR_COL"]]; 
[scanner scanHexInt:&b]; 
[scanner release]; 
self.navigationController.navigationBar.tintColor=[UIColor blackColor]; 
//self.navigationController.navigationBar.tintColor=UIColorFromRGB(b); 
views = [[NSMutableArray alloc] init]; 
NSMutableArray *innerArray =[[NSMutableArray alloc] init]; 
[innerArray addObject:@"Login"]; 

txnlist = [[NSMutableArray alloc] init]; 
[txnlist addObject:@"RRLGN00"]; 
NSMutableDictionary *menu1Dict = [NSMutableDictionary dictionaryWithObject:innerArray forKey:@"MENU"]; 
[menu1Dict setObject:txnlist forKey:@"MENUKEY"]; 
[views addObject:menu1Dict]; 
Engine *myEngine = [Engine sharedInstance]; 

**[myEngine setTableview:self.tableView];** 
[myEngine settableData:self.views]; 


[super viewDidLoad]; 
self.clearsSelectionOnViewWillAppear = NO; 
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); 
self.navigationItem.hidesBackButton = TRUE; 

} *

나는이 오류가 유지하고 내가 잘못하고 오전 그것이 무엇인지 알아낼 수 없습니다. 내 코코아 콩 파일, 분할보기 컨트롤러를 사용하고 있습니다. 메뉴를 처리하는 루트보기 컨트롤러와 세부 사항을 처리하는 상세보기 컨트롤러 (분명히). 이 줄을 주석 처리 할 때 [myEngine setTableview : self.tableView]; 앱이 실행되고 UIViewControllerHierarchyInconsistency 오류가 발생하지 않지만 메뉴를로드 할 수 없으므로 주석을 달고 있습니다. 누군가 제발 나를 도와주세요, 나는 이것을 빨리 필요로합니다. 제 삶은 그것에 달려 있습니다. 다시 한 번 감사드립니다.

EDITED

----

* - (BOOL) 애플리케이션 (UIApplication *) 애플리케이션 didFinishLaunchingWithOptions : (NSDictionary와 *)를 launchOptions {
[엔진 sharedInstance] setmenu_curr "RRLGN00"@]; [[엔진 sharedInstance] setProperties : [[NSMutableDictionary 할당] initWithDictionary : [NSMutableDictionary dictionaryWithContentsOfFile : [[NSBundle mainBundle] 번들 경로] stringByAppendingPathComponent : @ "app.plist"]]]]];

[[[Engine sharedInstance] properties] setObject:NSLocalizedString(@"FCDB_LANGID", nil) forKey:@"idLang"]; 

[[Engine sharedInstance] setUrl:[[[[Engine sharedInstance] properties] objectForKey:@"ENTITY_URL"] objectAtIndex:0]]; 
splashController = [[SplashViewController alloc]initWithNibName:@"SplashViewController" bundle:[NSBundle mainBundle]]; 
splashController.delegate=self; 
[self.window addSubview:splashController.view]; 
[self.window makeKeyAndVisible]; 

return YES; 

} - (무효) hideSplash {[splashController.view removeFromSuperview];

self.splitViewController =[[UISplitViewController alloc]init]; 
self.rootViewController=[[RootViewController alloc]init]; 
self.detailViewController=[[DetailViewController alloc]init]; 
UINavigationController *rootNav=[[UINavigationController alloc]initWithRootViewController:rootViewController]; 
UINavigationController *detailNav=[[UINavigationController alloc]initWithRootViewController:detailViewController]; 
//detailNav.navigationBarHidden=YES; 
self.splitViewController.viewControllers=[NSArray arrayWithObjects:rootNav,detailViewController,nil]; 
self.splitViewController.delegate=detailViewController; 
[window addSubview:self.splitViewController.view]; 
[self.window makeKeyAndVisible]; 

은} *

나는 당신이 무슨 말을 듣고 있지만 내가 메신저 뭔가 아주 간단 잘못, 또는 몇 가지 간단한 조정을하고 생각합니다. 위의 코드는 내 애플 리케이션 대리인입니다.

나는 http://www.iriphon.com/2012/03/31/uncaught-exception-uiviewcontrollerhierarchyinconsistency-reason-child-view-controller-should-have-parent-view-controller-but-actual-parent-is-or-apples-new-uiviewcontroller-hierarc/

에서이 웹 사이트를 확인하고 내가 그것을 메신저 뭘 함께 할 수있다 생각합니다. 내가 틀렸다면, 나에게 말해 줘.

+0

im이 올바르게 interpresting 경우 모르겠지만 두 줄의 동일한보기를 가리키는 컨트롤러가 있습니다 .. self.splitViewController.viewControllers = [NSArray arrayWithObjects : rootNav, detailViewController, nil]; self.splitViewController.delegate = detailViewController; [window addSubview : self.splitViewController.view]; – Sonic

답변

0

오류는 필요한 모든 것을 알려줍니다. 뷰는 원래 생성 된 뷰 컨트롤러에만 속할 수 있습니다.

나는 EngineUIViewController의 하위 클래스이거나 그 중 하나가 Engine에보기 컨트롤러가 포함되어 있다고 생각합니다. -setTableview: 메서드에서는 테이블 뷰를 해당 뷰 컨트롤러에 어떻게 든 추가한다고 추측합니다.

참고 : 실제로이 테이블보기가 Engine의 일부로 필요하면 RootViewController으로 연결을 완전히 분리해야합니다. 실제로, 나는 이것을 한 번도 본 적이 없다.

P. [super viewDidLoad]-viewDidLoad에서 가장 먼저 전화해야합니다. 업데이트 된 코드에 대한


댓글

참고 :이 문제를 해결할 생각하지 않는다, 그러나 창을 설정하는 올바른 방법입니다.

[self.window addSubview:splashController.view][window addSubview:self.splitViewController.view]을 사용하지 마십시오. 대신 self.window. rootViewController = splashControllerself.window.rootViewController = self.splitViewController이어야합니다.

+0

위의 게시물을 편집하고 더 많은 코드를 추가했습니다. 한 번 생각해보고 알려주세요. 감사. – Sonic

+0

im이 올바르게 interpresting 경우 모르겠지만 두 줄의 동일한보기를 가리키는보기 컨트롤러가 있습니다 .. self.splitViewController.viewControllers = [NSArray arrayWithObjects : rootNav, detailViewController, nil]; self.splitViewController.delegate = detailViewController; [창 addSubview : self.splitViewController.view]; – Sonic

+0

@Sonic 당신이 지적하려고하는 것이 확실하지 않습니다. 'self.splitViewController.viewControllers = [NSArray arrayWithObjects : rootNav, detailViewController, nil]'하위보기 컨트롤러 (legit)를 가리키는 컨트롤러입니다. 'self.splitViewController.delegate = detailViewController'는 델리게이트 (legit)를 설정하고 있습니다. '[window addSubview : self.splitViewController.view]'는 이미 주석 처리 한 코드입니다. –

관련 문제