这是我显示图像选择器的代码:
let pickerController = UIImagePickerController()
pickerController.delegate = self
pickerController.allowsEditing = false
pickerController.mediaTypes = [kUTTypeMovie as String]
pickerController.sourceType = .photoLibrary
在代表中,我有:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
guard let videoURL = info[.mediaURL] as? URL
else { return }
do {
let newFileLocation = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString + ".mov")
FileManager.default.moveItem(at: videoURL, to: newFileLocation)
} catch {
// “trim.92501481-FA5B-490C-8F55-575DE076C8A1.MOV” couldn’t be moved because you don’t have permission to access “tmp”
}
}
我回去在 iOS 13.5 上尝试了这个,它工作正常,但在 iOS 13.7 中我遇到了这个奇怪的错误。