0

我在理解为什么会发生这种情况时遇到了一些麻烦,但是由于某种原因,当第二次触发 NSNotification 时会发生这种情况:

-[UITableViewCel lContentView imageFound:]: unrecognized selector sent to instance 0x1cd837e0 2013-08-12 16:32:24.340 poundtaxi[7483:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView imageFound:]: unrecognized selector sent to instance 0x1cd837e0'

* First throw call stack: (0x344d92a3 0x3c17e97f 0x344dce07 0x344db531 0x34432f68 0x3442a037 0x34d40599 0xd7d9f 0x33d64145 0x3c59611f 0x3c5954b7 0x3c596dcb 0x344acf3b 0x3441febd 0x3441fd49 0x37fe32eb 0x36335301 0xb963d 0x3c5b5b20) libc++abi.dylib: terminate called throwing an exception

这是被执行的代码块:

-(void)imageFound:(NSNotification *)aNotification {
    NSDictionary* userInfo = [aNotification userInfo];
    Picture *aPicture = (Picture *) [userInfo objectForKey:@"picture"];
    UIImage *image = (UIImage *) [userInfo objectForKey:@"image"];

    aPicture.highResPicture = image;
    self.count++;
 }
4

1 回答 1

1

注册的观察者对象很可能在作为观察者被移除之前被释放。永远记得在 dealloc 中删除通知中心观察者。

于 2013-08-12T20:38:39.557 回答