I am writing code with PHAsset and getting this error "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)
when code PHAsset.fetchAssets(with: optionForallPhotos) is executed.
Can someone help me ?
Below is my code.
when code PHAsset.fetchAssets(with: optionForallPhotos) is executed.
Can someone help me ?
Below is my code.
I've already added Photo library access auth request in the Info.plist
Code Block class PhotoData { private let fetchLimit: Int = 300 private let modelInputResolution: CGSize = CGSize(width: 100, height: 100) private let imageRequestOptions = PHImageRequestOptions() private var allPhotos: PHFetchResult<PHAsset>! var phAssets: [PHAsset] = [] fileprivate let imageManager = PHImageManager.default() // fileprivate let imageManager = PHCachingImageManager() // TODO - 생성자 init() { imageRequestOptions.isSynchronous = true imageRequestOptions.deliveryMode = PHImageRequestOptionsDeliveryMode.highQualityFormat imageRequestOptions.resizeMode = PHImageRequestOptionsResizeMode.exact loadPhotosFromAlbum() } func loadPhotosFromAlbum() { // load all photos let optionForallPhotos = PHFetchOptions() optionForallPhotos.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] // optionForallPhotos.fetchLimit = fetchLimit allPhotos = PHAsset.fetchAssets(with: optionForallPhotos) // allPhotos = PHAsset.fetchAssets(with: .image, options: nil) } }