【发布时间】:2019-05-31 07:41:05
【问题描述】:
在我的应用程序中,我正在使用此代码获取所有照片(PHAsset)
PHPhotoLibrary.requestAuthorization { (status) in
switch status {
case .authorized:
print("Good to proceed")
let fetchOptions = PHFetchOptions()
let allPhotos = PHAsset.fetchAssets(with: .image, options: fetchOptions)
print("Found \(allPhotos.count) images")
case .denied, .restricted:
print("Not allowed")
case .notDetermined:
print("Not determined yet")
@unknown default:
fatalError()
}
}
我有两个问题:
- 我可以从照片库中获取按类别分组的照片吗? (见下图)
- 我可以按类别对照片进行分组吗? (见下图)
【问题讨论】:
-
计算机如何知道哪些照片是花,哪些是动物?
-
@matt Apple 通过图像识别完成了它。
-
@matt 你明白我的问题吗?
标签: ios swift phasset photosframework