Has anyone experienced crashes when using ALAssetsLibrary in a background thread?

后端 未结 4 1546
死守一世寂寞
死守一世寂寞 2021-02-15 13:41

I have an ios app which has not crashed in this way on ios 5 which is now crashing consistently on ios 6 on startup after 4 or 5 bg/fg cycles. I\'ve traced the issue to my invo

4条回答
  •  日久生厌
    2021-02-15 14:05

    It turns out this has all been related to reallocating the ALAssetsLibrary for each sync. By adding a member variable instead, the crashing appears to have disappeared.

    assetsLibrary = [[ALAssetsLibrary alloc] init];

    While this is clearly a more efficient/better design for my code, I'd say the problems I've had indicate some ARC issue with ALAssetsLibrary and threading. Make sure to only allocate once!

提交回复
热议问题