协议中的 EXC_BAD_ACCESS?
我在下一行收到 EXC_BAD_ACCESS,可能是什么原因,谁能解释一下
if([self.delegate respondsToSelector:@selector(dealInfo:imageDidDownload:indexPath:)])//Here is EXC_BAD_ACCESS
[self.delegate dealInfo:self imageDidDownload:thumbImage indexPath:self.indexPath];
我已经完成了 deal.delegate=self;,并且 deal 是在 UITableView 的委托方法中声明的,
cellForRowAtIndexPath
如下所示
DealInfo *deal = [nearByDeals objectAtIndex:(section - 1)];
deal.delegate = self;
deal.indexPath = indexPath;
帮助!
I am getting EXC_BAD_ACCESS at the following line, what can be possbile reason, can any one explain
if([self.delegate respondsToSelector:@selector(dealInfo:imageDidDownload:indexPath:)])//Here is EXC_BAD_ACCESS
[self.delegate dealInfo:self imageDidDownload:thumbImage indexPath:self.indexPath];
I have done deal.delegate=self;, and deal is declared in delegate method of UITableView
cellForRowAtIndexPath
something like below
DealInfo *deal = [nearByDeals objectAtIndex:(section - 1)];
deal.delegate = self;
deal.indexPath = indexPath;
HELP!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
EXC_BAD_ACCESS 通常意味着您正在尝试访问已释放的对象。在这种情况下,委托可能会在您调用
respondsToSelector:
之前被释放。EXC_BAD_ACCESS usually means you're trying to access a released object. In this case, delegate is probably released before you call
respondsToSelector:
on it.