diff --git a/packages/image_picker/CHANGELOG.md b/packages/image_picker/CHANGELOG.md index e0956f2b7163..f049af5e8794 100644 --- a/packages/image_picker/CHANGELOG.md +++ b/packages/image_picker/CHANGELOG.md @@ -1,6 +1,9 @@ -## 0.5.0+4 +## 0.5.0+5 + +* Fixed record video has two files on IOS. -Preserve transparency when saving images. +## 0.5.0+4 +* Preserve transparency when saving images. ## 0.5.0+3 diff --git a/packages/image_picker/ios/Classes/ImagePickerPlugin.m b/packages/image_picker/ios/Classes/ImagePickerPlugin.m index 0bff07aed34e..1864272f2507 100644 --- a/packages/image_picker/ios/Classes/ImagePickerPlugin.m +++ b/packages/image_picker/ios/Classes/ImagePickerPlugin.m @@ -136,17 +136,19 @@ - (void)imagePickerController:(UIImagePickerController *)picker return; } if (videoURL != nil) { - NSData *data = [NSData dataWithContentsOfURL:videoURL]; NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString]; NSString *tmpFile = [NSString stringWithFormat:@"image_picker_%@.MOV", guid]; NSString *tmpDirectory = NSTemporaryDirectory(); NSString *tmpPath = [tmpDirectory stringByAppendingPathComponent:tmpFile]; + NSString *videoPath = [videoURL.absoluteString stringByReplacingOccurrencesOfString:@"file://" + withString:@""]; + NSError *error = nil; - if ([[NSFileManager defaultManager] createFileAtPath:tmpPath contents:data attributes:nil]) { + if ([[NSFileManager defaultManager] moveItemAtPath:videoPath toPath:tmpPath error:&error]) { _result(tmpPath); } else { _result([FlutterError errorWithCode:@"create_error" - message:@"Temporary file could not be created" + message:[NSString stringWithFormat:@"%@", error] details:nil]); } } else {