Search code examples
iosphotosalassetslibraryphasset

ALAssetLibrary , it only shows partial number of photos in All Photos on some devices


I used to use ALAsset, it works well for iOS7~iOS9 for most users (about 100K) . But some users complain it only show partial number of photos on i6 device, ios8/ios9. (Maybe 1% has this problem, I'm not sure.)

I have the i6 ios9 device, but my device can't show the the same problem. Users said App only show photos for the two month past. How does it happen ?

For their device, they don't have camera roll album, but mime has. I'm not sure if it cause the problem. How to solve this problem ? Should I change to PHAsset Photos from iOS8.


Solution

  • I found the root cause, which ALAssetLibrary can't read some photos for iOS8/iOS9. It result from that iCloud is enabled and optimize for storage is chosen.

    https://support.apple.com/en-us/HT204264 On your iPhone, iPad, or iPod touch, tap Settings > iCloud > Photos or Settings > Photos & Camera, then select a storage setting. turn on Optimize [device] Storage.

    So, ALAssetLibrary can't read these photos uploaded to iCloud. For users to workaround. 1. he can use Photos app to edit the photo rotate and rotated back save. And ALAssetLibrary can read again. 2. disable Optimize device Storage and connect wifi & power. the photo will be pulled back to device from iCloud.

    For programming side, I think the only way is to use Photos/PHAsset for iOS8/iOS9. Photos framework can read thumbnail and original from iCloud.

    Do you have other solutions?