在最新版本的照片库中不建议使用fetchAssetCollections方法吗?

问题描述 投票:0回答:1

我用XCode创建了一个命令行项目

enter image description here

我认为这是迅速的有效代码

 let all = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary,  

但是,当我现在尝试时,自动完成功能不会列出fetchAssetCollections作为选项。

enter image description here

我的构造函数中的类似问题

enter image description here

这里是代码片段

import Foundation
import Photos

class PhotoExplorer {

    init() {
        PHPhotoLibrary.shared().register(self)
    }

    func listAssetsInPhoto() -> PHCollection {
        let fetchOptions = PHFetchOptions()
        PHAssetCollection.fetch //  <- To be complete

    }
}

这是我的构建设置

enter image description here

我添加了import PhotosUI,但没有帮助。

我做错什么了吗? API是否有更改?

swift xcode macos xcode10 xcode10.3
1个回答
0
投票
解决它的唯一方法是通过重新创建项目。
© www.soinside.com 2019 - 2024. All rights reserved.