I have a UICollectionView
where I am filling up the cells with images downloaded from the Internet. For this I am using SDWebImage
. My code looks like this:
-(UICollectionViewCell*) collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
NSString *CellIdentifier = @"Gallery_Cell";
GalleryCell *cell= (GalleryCell *)[self.flowCollection dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
if (indexPath.row < self.collectionData.count) {
CellDetails *dets = [self.collectionData objectAtIndex:indexPath.row];
NSURL *mainImageURL = [NSURL URLWithString:dets.imageURL];
cell.image.contentMode = UIViewContentModeScaleAspectFill;
cell.image.clipsToBounds = YES;
[cell.image setImageWithURL:mainImageURL placeholderImage:nil];
}
return cell;
}
I believe I have set this up correctly. But the app crashes (EXC_BAD_ACCESS
) completely at random sometimes leaving this stack trace:
There is no other message in the log area. I tried setting an exception breakpoint, but each time this crash occurs, showing this stack trace. Does anyone have any idea what might be the problem?