Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView mysterious crash

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:

enter image description here

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?

like image 335
Rameez Hussain Avatar asked Dec 06 '13 14:12

Rameez Hussain


1 Answers

If anyone is looking for the answer, I have solved the problem and answered another one of my questions related to the same issue. You can find it here. Hope it helps!

like image 147
Rameez Hussain Avatar answered Sep 30 '22 14:09

Rameez Hussain