我有一个对象Person
,一个协议PersonDelegate
Person
有一个@property (assign) id<PersonDelegate> delegate
;
在我的代码中某处我做:
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?