할당 해제의 위임에 방법을 부르는 @property (assign) id<PersonDelegate> delegate
을; 내 코드에서목적 C - 내가 객체 <code>Person</code> 및 프로토콜 <code>PersonDelegate</code><br> <code>Person</code>이 가지고있는
어딘가에 내가 할 : 대리자가 이미 할당 해제 되었기 때문에이
Person *newPerson = [[Person alloc] init];
newPerson.delegate = theDelegate;
...
[theDelegate release]; // and dealloc
...
now Person has some new information for the delegate, so I call in Person
[self.delegate doSomething];
하지만 난 EXC_BAD_ACCESS
얻고 있습니까? Person은 자신의 대리자가 dealloc임을 어떻게 알 수 있습니까?
대개 대리인이 지정됩니다. 어떻게 작동합니까? – Eyal
아마도 대부분의 대리자는 뷰 컨트롤러이거나 개체 자체보다 더 오래 지속되는 개체이기 때문입니다. 이 경우 그는 즉시 대리인을 해제합니다. – giorashc