Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit e80fe21

Browse files
author
Miguel Ruivo
committed
fixes an issue that could result in a crash when picking videos from gallery on iOS 13 or above
1 parent a2b5a77 commit e80fe21

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/image_picker/ios/Classes/ImagePickerPlugin.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ - (void)imagePickerController:(UIImagePickerController *)picker
241241
return;
242242
}
243243
if (videoURL != nil) {
244+
if(@available(iOS 13.0, *)) {
245+
246+
NSString * fileName = [videoURL lastPathComponent];
247+
NSURL * destination = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:fileName]];
248+
249+
if([[NSFileManager defaultManager] isReadableFileAtPath: [videoURL path]]) {
250+
[[NSFileManager defaultManager] copyItemAtURL:videoURL toURL:destination error:nil];
251+
videoURL = destination;
252+
}
253+
}
244254
self.result(videoURL.path);
245255
self.result = nil;
246256
} else {

0 commit comments

Comments
 (0)