0

we are a bit confused how device cache is working and how it is suppose to be working. Images with an original resolution smaller than what is specified in the request do not seem to be cached at all and every time we call RequestImageForAsset looks like the image is always pulled from the cloud. When it happens, it also shows an interesting behavior that we did not see it documented. Although RequestImageForAsset callback does not return an error, the expected produced UIImage is nil. The only way to get an image is to request it again with a smaller size.
Photos showing this behavior are shown in "Photos app" with a white dot. Only after forcing a zoom in by double clicking it, that dot disappears and only after that moment we are able to request it properly through RequestImageForAsset.

Any help is welcome

cheers Manuel

2 Answers2

0

The caching behavior (due to my testing) depends on many factors:

1) if the user has set "Optimize Storage" or "Keep originals" in the Photos Settings

2) How much space is available on the device.

In short: I would not assume any caching behavior. Just use the supplied methods of PhotoKit to request the data/image of the asset.

holtmann
  • 6,043
  • 32
  • 44
0

I have to disagree with you. You have to understand how local cache works to:

1 - according to what you are doing in your app, take some decisions like if you should cache photos yourself

2 - understand the difference between a bug an a feature. Photokit looks nice. However, its implementation has been showing a lot of issues (true bugs) and things like changing from 8.0 beta 5 to 8.0 release master recently added / camera roll which exposes some internal confusion