6

Exception/crash upon calling PHImageManager requestImageForAsset:targetSize:contentMode:options:resultHandler:

"uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity."

Happens 100% of the time when requesting images for assets that are not yet loaded locally on the phone - typically older photos deeper in the photo roll.

I've made sure PHAsset is not nil and is valid. Also tried with a variety of options/modes. Crashes both for synchronous and async request. Here's an example of a PHAsset that causes a crashes when image is requested:

<PHAsset: 0x11c712680> A38CCD23-639B-4D81-B499-03F7A429481E/L0/001 mediaType=1/8, sourceType=1, (4032x3024), creationDate=2017-10-22 22:34:40 +0000, location=1, hidden=0, favorite=0, adjusted=0

This is a new crash on iOS 13.

The same assets don't load on apps like Instagram either (only load properly on Apple's photo app), so something off on iOS13. However, Instagram manages not to crash in this case. While loading the image properly would be ideal, I'm trying to at least handle this gracefully and not crash, like Instagram does. Unfortunately try/catch doesn't catch this exception somehow.

Any tips on how to handle this?

Community
  • 1
  • 1

0 Answers0