我是Swift的新手,我正在尝试创建一个函数,只需使用fetchAssetCollections返回截屏相册中的照片数量
我有
func getNumScreenshots() -> Int {
let collection:PHFetchResult =
PHAssetCollection.fetchAssetCollections(with: .album, subtype:.smartAlbumScreenshots, options: nil)
return collection.count
}
Run Code Online (Sandbox Code Playgroud)
但是,这总是返回3,我不知道为什么(我的iPhone上有600个截图).