countByEnumeratingWithState
방법을 구현하기 위해 노력하고
(예를 들어이 방법 MyClass
나는구현
MyOtherClass *cl = [[MyOtherClass alloc] init];
buffer[count++] = cl;
이유를 할 Fastenumeration 그 때문이다 객체는 '다른 곳'저장되는 응용 프로그램에서이 방법을 사용하는 경우 그러나,이 충돌합니다.
for (const MyOtherClass *cl in myClassObj){
NSLog(@"obj: %@", cl.description);
}
그 이유는 ARC 내 MyOtherClass 객체를 멀리 던진다 가능성이 높습니다 버퍼가 'unretained'이기 때문에 countByEnumeratingWithState에서. MyOtherClass 객체가 '보유'되어 있는지 어떻게 확인할 수 있습니까?
더 많은 관련 정보 :
- 스레드 # 4 : TID = 0x5ca941, 0x0000000101a4cf8b libobjc.A.dylib
objc_msgSend + 11, stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x0000000101a4cf8b libobjc.A.dylib
objc_msgSend +
stacktrace를 게시하십시오. – trojanfoe
버퍼 선언을 보겠습니다. –