This was fine until beta 6 of iOS 12. Now fetching "All Photos" is not happening properly.
For the last photo, it shows a random photo from the middle. All Photos is loaded improperly.
Fetching all photos:
let allPhotosOptions = PHFetchOptions()
self.assetsFetchResults = PHAsset.fetchAssets(with: allPhotosOptions)
self.assetCollection = PHAssetCollection.transientAssetCollection(withAssetFetchResult: self.assetsFetchResults!, title: "All Photos")
Fetching Last Photo:
let allPhotosOptions = PHFetchOptions()
let assetsFetchResults = PHAsset.fetchAssets(with: allPhotosOptions)
if assetsFetchResults.count == 0 {
self.showCameraRollEmptyAlert()
return nil
}
let asset = assetsFetchResults.lastObject
This started happening on beta 6, it was fine with previous betas.