Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何使用Photos.Framework将自定义数据保存到PHAsset_Ios_Swift_Video_Phasset_Phphotolibrary - Fatal编程技术网

Ios 如何使用Photos.Framework将自定义数据保存到PHAsset

Ios 如何使用Photos.Framework将自定义数据保存到PHAsset,ios,swift,video,phasset,phphotolibrary,Ios,Swift,Video,Phasset,Phphotolibrary,Im使用照片框架保存和检索设备相册中的视频 在保存视频时,我想添加一些自定义数据,如:id、名称、描述等。。。 并在从相册中检索时获取所有这些数据 可能吗 我用来保存视频的代码是: func saveVideo(url: URL, completionHandler: @escaping (Bool, Error?) -> ()) { if assetCollection == nil { return // If there was

Im使用照片框架保存和检索设备相册中的视频

在保存视频时,我想添加一些自定义数据,如:id、名称、描述等。。。 并在从相册中检索时获取所有这些数据

可能吗

我用来保存视频的代码是:

    func saveVideo(url: URL, completionHandler: @escaping (Bool, Error?) -> ()) {

        if assetCollection == nil {
             return   // If there was an error upstream, skip the save.
        }

        PHPhotoLibrary.shared().performChanges({
            let assetChangeRequest = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url)
            let assetPlaceholder = assetChangeRequest?.placeholderForCreatedAsset
            let albumChangeRequest = PHAssetCollectionChangeRequest(for: self.assetCollection)
            albumChangeRequest?.addAssets([assetPlaceholder] as NSFastEnumeration)
        }, completionHandler: {
            saved, error in
            completionHandler(saved,error)
        })
    }