ios13 [PHImageManager requestImageForAsset] crash

use requestImageForAsset: method to synchronous fetch an asset's image, sometimes crash on ios 13.x(including 13.0,13.1,13.1.1)

crash log are as follows

Thread 23 Crashed:
0 libobjc.A.dylib objc_msgSend (in libobjc.A.dylib) + 16
1 CoreFoundation -[__NSDictionaryM objectForKeyedSubscript:] (in CoreFoundation) + 180
2 PhotoLibraryServices PLDataStoreForClassIDAndLibraryID (in PhotoLibraryServices) + 472
3 PhotoLibraryServices +[PLManagedAsset(RM) enumerateImageRequestHintData:assetWidth:assetHeight:libraryID:startingOffset:block:] (in PhotoLibraryServices) + 320
4 Photos _presentResourcesFromHintsUntilStop (in Photos) + 360
5 Photos PHChooserListContinueEnumerating (in Photos) + 64
6 Photos -[PHImageResourceChooser presentNextQualifyingResource] (in Photos) + 1448
7 Photos -[PHImageRequest startRequest] (in Photos) + 2100
8 Photos -[PHMediaRequestContext _registerAndStartRequests:] (in Photos) + 1076
9 Photos -[PHMediaRequestContext start] (in Photos) + 256
10 Photos -[PHImageManager runRequestWithContext:] (in Photos) + 320
11 Photos -[PHImageManager requestNewCGImageForAsset:targetSize:contentMode:options:resultHandler:] (in Photos) + 1116
12 Photos -[PHImageManager requestImageForAsset:targetSize:contentMode:options:resultHandler:] (in Photos) + 184
13 DPScope -[UGCPHImageRequestOperation requestImageData] (in DPScope) (UGCPHImageRequestOperation.m:125)
14 Foundation __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ (in Foundation) + 20
15 Foundation __NSOQSchedule_f (in Foundation) + 180
16 libdispatch.dylib _dispatch_block_async_invoke2 (in libdispatch.dylib) + 104
17 libdispatch.dylib _dispatch_client_callout (in libdispatch.dylib) + 16
18 libdispatch.dylib _dispatch_continuation_pop$VARIANT$armv81 (in libdispatch.dylib) + 404
19 libdispatch.dylib _dispatch_async_redirect_invoke (in libdispatch.dylib) + 592
20 libdispatch.dylib _dispatch_root_queue_drain (in libdispatch.dylib) + 344
21 libdispatch.dylib _dispatch_worker_thread2 (in libdispatch.dylib) + 116
22 libsystem_pthread.dylib _pthread_wqthread (in libsystem_pthread.dylib) + 212
23 libsystem_pthread.dylib start_wqthread (in libsystem_pthread.dylib) + 8


somebody know what's the problem?

Replies

I ran into this crash when I was setting resizeMode to none. Setting it to exact fixed the crash for me. /shrug

I'm seeing this as well, not consistently, resizeMode is set to fast. As mentionned by TheRa1nMan, it seems to be iOS 13 only.


Anyone seeing this occurring still?

Happening to me 😟 so frustating! Anyone knows how to avoid? I set to exact size but crashing anyway. Only iOS 13.

Same thing here. iOS 13.3 different devices.

Anyone figured this out?

We're getting this crash A LOT in our live app but unable to identify the parameters that triggers it..


Thank you