PHPicker: handle missing internet connection

We have a lot of users reporting to us that they can't load images into our app. They just "see the spinner spin indefinitely". We now think we found the reason why:

When trying to load an asset via the PHPickerViewController that is not downloaded yet without an active internet connection, the loadFileRepresentationmethod of the item provider will just stall without reporting any progress or error. The timeout for this seems to be 5 minutes, which is way too high.

The same is true if the user disabled cellular data for Photos and attempts to load a cloud asset while not on wifi.

Steps to reproduce:

  1. have a photo in iCloud that is not yet downloaded
  2. activate Airplane Mode
  3. open the picker and select that photo
  4. see when loadFileRepresentation will return

Since it is clear that without an internet connection the asset can’t be downloaded, I would hope to be informed via a delegate method of the picker or the loadFileRepresentation callback that there was an error trying to load the asset. (FB9221090)

Right now we are attempting to solve this by adding an extra timer and a network check. But this will not catch the "no cellular data allowed"-case.

Please consider some callback mechanism to the API so we can inform the user what the problem might be. Thanks!

Thanks for the feedback!

Related: in iOS 15, you can show a loading indicator by using the loading progress returned by the NSItemProvider object.

PHPicker: handle missing internet connection
 
 
Q