我是新来的斯威夫特,我试图做一个函数,简单地返回您的截图相册的照片数量使用fetchAssetCollections获取截图(专辑)计数迅速
我
func getNumScreenshots() -> Int {
let collection:PHFetchResult =
PHAssetCollection.fetchAssetCollections(with: .album, subtype:.smartAlbumScreenshots, options: nil)
return collection.count
}
然而,这总是返回3,我不知道为什么(我的iPhone上有600张截图)。
可以使用smartAlbum –