Here is my code for displaying an image picker:
let pickerController = UIImagePickerController()
pickerController.delegate = self
pickerController.allowsEditing = false
pickerController.mediaTypes = [kUTTypeMovie as String]
pickerController.sourceType = .photoLibrary
In the delegate I have:
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”
}
}
I went back and tried this on iOS 13.5 and it works fine, but in iOS 13.7 I am getting this strange error.
Ah simple fix, change:
to