MPMediaItemPropertyArtwork causes crash (weird issue)

前端 未结 2 559
花落未央
花落未央 2021-01-21 22:56

allocations before running \'extra loop\' \"allocations

The code:

相关标签:
2条回答
  • 2021-01-21 23:12

    The problem was that UIImage usually keeps just a ref(CGImageRef), which is a small one. After displaying items, CGImageRef was 'injected' with information. As a result the table was growing all the time.

    The simple but not the most beautiful solution was to use the code:

    NSArray = @[obj1, obj2, obj3]; // where obj is custom NSObject and has a UIImage property
    

    instead of:

    NSArray = @[img1, img2, img3]; // where img is of UIImage type
    
    0 讨论(0)
  • 2021-01-21 23:23

    Wrap in @autorelease pool?

    Also, why are you setting the image for veryTemp (I assume it's a UIImageView) 800 times in [veryTemp setImage:coverImage]; ?

    Finally:

    [_albumCovers objectAtIndex:indexPath.row];
    

    You're getting the image object at the exact same index (indexPath.row) in your loop. I am not quite sure what you're trying to achieve in your code?

    0 讨论(0)
提交回复
热议问题