I am trying to get the filename
(red box on screenshot) for my pictures in Photos.
I can retrieve all Pictures as PHAssets
. But i don't know how to access that filename information.
import Foundation
import Photos
private var allPhotos = PHFetchResult<PHAsset>()
let allPhotosOptions = PHFetchOptions()
allPhotosOptions.sortDescriptors = [
NSSortDescriptor(
key: "creationDate",
ascending: false)
]
allPhotos = PHAsset.fetchAssets(with: allPhotosOptions)
allPhotos.enumerateObjects { (asset, start, stop) in
print("######################")
print(asset.localIdentifier)
print(asset.description)
print(asset.attributeKeys.description)
}
This is all the information i seem to get for each picture.
951110A3-D9FF-4922-9155-FA206AA07C7E/L0/001 <PHAsset: 0x14e90bdc0> 951110A3-D9FF-4922-9155-FA206AA07C7E/L0/001 mediaType=1/4, sourceType=1, (1125x2436), creationDate=2023-11-15 09:01:33 +0000, location=0, hidden=0, favorite=0, adjusted=0 []
What am i doing wrong?