2009-06-18 6 views
1

성공적으로 빌드 된 다음 코드 조각이 나에게 잘 보이지만 작동하지 않습니다 ... 내가 핵심 가치 코딩을 처음 접했을 때 귀하의 도움이 크게 감사 할 것입니다. .. 테이블 뷰 대리인 didSelectRowAtIndexPath의 여기 방법 categoriesList 5 개 항목NSUnknownKeyException, KVC 준수 코드가 작동하지 않습니다.

이제 어떤 로우가 함께 선택 될 때 밀리 내 다음 컨트롤러 loadArray의 아이바에 childControllerArray 전달
NSUInteger row = [indexPath row]; 
NSString *rowString = [categoriesList objectAtIndex:row]; 
NSString *path = [[NSBundle mainBundle] pathForResource:@"DataBase" ofType:@"plist"]; 
NSDictionary *rootDict = [[NSDictionary alloc] initWithContentsOfFile:path]; 
NSArray *allRootKeys = [rootDict allKeys]; 
NSMutableArray *mutableArray = [[NSMutableArray alloc] init]; 
for (NSString *name in allRootKeys) { 
    NSInteger index = [allRootKeys indexOfObject:name]; 
    NSDictionary *newDict = [allRootKeys objectAtIndex:index]; 
    if ([newDict valueForKey:@"Class"] == rowString) 
     [mutableArray addObject:[allRootKeys objectAtIndex:index]]; 
} 
NSArray *childControllerArray = [[NSArray alloc] initWithArray:mutableArray]; 

간단한 표이다 특정 배열 및 그 배열의 내용을 표시합니다 .... 위의 코드를 삭제하고 간단한 배열을 전달하면 그것에 개체, 그것은 주어진 예외가

도와주세요 잘 .... 방법 :

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSCFString 0x543eb0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key Class.

답변

0

[rootDict해서 AllKeys]; //이 NSStrings의 배열, NSDictionarys

의 NOT 배열 이

이 코드는

NSArray *allRootKeys = [rootDict allKeys]; 
NSDictionary *newDict = [allRootKeys objectAtIndex:index]; 
그것은 할 수
+0

및 않습니다 작동하지만 newDict에 저장된 값이 과정의 NSDictionary에없는 일을 할 수있다 : P – rpetrich

+0

그것은 작동합니다. 하지만 의미가 없습니다 – oxigen

+0

및이 : [newDict valueForKey : @ "클래스"] 작동하지 않습니다)) – oxigen

관련 문제