Chatar Veer Suthar
Chatar Veer Suthar

Reputation: 15639

EXC_BAD_ACCESS in protocol?

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!

Upvotes: 0

Views: 590

Answers (1)

Can Berk Güder
Can Berk Güder

Reputation: 113310

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.

Upvotes: 4

Related Questions