MPMediaItemPropertyArtwork causes crash (weird issue)

a 夏天 提交于 2019-12-01 23:54:39

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

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?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!