PHAssetCreationRequest不工作​​

问题描述:

我试图使用PHAssetCreationRequest将视频文件从我的文档文件夹移动到相机胶卷。我无法找到一个很好的例子,说明如何从Apple文档或网络上的任何位置执行此操作。下面的代码失败了,但我不知道为什么。我是否需要以某种方式在完成块中触发请求?PHAssetCreationRequest不工作​​

我已验证电影文件存在于我的文档目录中(我将应用程序资源下载到我的Mac并且视频正常工作)。

PHPhotoLibrary.sharedPhotoLibrary().performChanges({() -> Void in 
    let request = PHAssetCreationRequest.creationRequestForAssetFromVideoAtFileURL(movieUrl!) 
      }, completionHandler: { (success: Bool, error: NSError?) -> Void in 
       print(success) 
       print(error) 
}) 

谢谢!

我的例子为我工作

PHPhotoLibrary.sharedPhotoLibrary().performChanges({() -> Void in 
      PHAssetCreationRequest.creationRequestForAssetFromVideoAtFileURL(outputFileURL) 
      }, completionHandler: { (success, error) -> Void in 
       if success { 
        print("it works!!!") 
        self.removeVideo() 
       } 
       if error != nil { 
        print(error?.localizedDescription)