2009-11-08 6 views
0

appdata.items는 NSMutableArray 개체입니다.약 removeObjectAtIndex

소스 코드

이 오류의 원인 로그

2009-11-08 21:53:01.683 xxx[14283:207] (
    200, 
    "", 
    2009-11-08 21:52:53 +0900 
) 
2009-11-08 21:53:01.684 xxx[14283:207] 0 
2009-11-08 21:53:01.685 xxx[14283:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)' 

-(void)deleteAppDataItemId:(NSInteger)identifier{ 
    NSLog(@"%@", [appdata.items objectAtIndex:identifier]); 
    NSLog(@"%i", identifier); 
    [appdata.items removeObjectAtIndex:identifier]; 
} 

?

+0

[appdata.items 수]도 기록 할 수 있습니까? appdata.items가 비어있는 것 같습니다. – diederikh

+0

이것은 [appdata.items count] 로그입니다. 2009-11-08 22 : 23 : 51.861 xxx [14387 : 207] 1 – marcy

+2

다른 스레드에서 appdata.items를 수정하는 응용 프로그램의 다른 부분이 있습니까? – diederikh

답변

0

다른 배열에서 충돌이 발생한다고 생각합니다. 디버거를 사용해 보셨습니까?

2

objc_exception_throw에서 중단되도록 디버거를 설정 한 다음 디버거에서 프로그램을 실행하십시오. 예외가 발생하면 스택 추적을 살펴보십시오. 스택의 일부 프레임은 코코아 또는 CF 코드로 표시됩니다. 다른 것들은 당신의 코드에있을 것입니다. 코드에있는 맨 위 프레임으로 전환하고 변수 검사를 시작하십시오. 이런 식으로 문제를 찾아야합니다.