I want to retrieve timestamp of media that is stored in photo library on device. I found a solution but it for ALAssetLibrary
that is deprecated in iOS 9.0+. I want to do so using Photos
framework. Please help.
Here is the full answer:
let assets = PHAsset.fetchAssetsWithMediaType(.Image, options: nil)
for i in 0..<assets.count {
guard let asset = assets[i] as? PHAsset else {fatalError("Cannot cast as PHAsset")}
print("creation date: \(asset.creationDate)")
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.