Wednesday, 27 February 2019

How do I test PHImageResultIsInCloudKey?

My app has a custom photo picker that uses the Photos framework to browse albums and select a photo. I have isolated reports of a very specific bug that occurs only if the user (a) has iCloud Photo Library turned on, (b) has Optimize Storage turned on in their Photos settings and (c) that specific album and/or image has been moved off the device.

In this scenario, it looks like no actual image is returned to the closure I pass to PHCachingImageManager#requestImage. Instead, from what I gather, PHImageResultIsInCloudKey is included in the info dictionary and I need to re-invoke the request with isNetworkAccessAllowed set to true.

However, in my own testing, I just can't get this specific scenario to occur so I can confirm that my fix works. Even with iCloud Photo Library on and Optimize Storage on, I still always get an image back and never get PHImageResultIsInCloudKey.

Is there a way to force a situation where the image is off-device and has to be loaded from the cloud?



from How do I test PHImageResultIsInCloudKey?

No comments:

Post a Comment