When importing more than 1000 images in iOS9, a few images show "The file "IMG----.JPG" couldn't be opened because you don't have permission to view it. The file "IMG.JPG" couldn't be opened because you don't have permission to view it" appears for a few photos, and they cannot be imported.
The images in Photolibrary are retrieved by PHAsset.fetchAssets.
In iOS 10.3.3 or later, the same program does not cause this problem.
I checked the log to see if the URL or Asset was nil, but I didn't find anything wrong with the images that were successfully loaded.
Some of the codes we are getting are listed below.
The images in Photolibrary are retrieved by PHAsset.fetchAssets.
In iOS 10.3.3 or later, the same program does not cause this problem.
I checked the log to see if the URL or Asset was nil, but I didn't find anything wrong with the images that were successfully loaded.
Some of the codes we are getting are listed below.
Code Block Swift private func _getAssetOption() -> PHFetchOptions { let option = PHFetchOptions() option.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)] option.includeAssetSourceTypes = .typeUserLibrary option.includeAllBurstAssets = true return option } private func _getAssets() -> PHFetchResult<PHAsset> { return PHAsset.fetchAssets(with: .image, options: _getAssetOption()) }