@@ -104,7 +104,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
104104 ];
105105 _imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
106106 if (@available (iOS 11.0 , *)) {
107- NSLog ( @" enable passthrough mode in video-picking mode." );
107+ // Enable passthrough mode in video-picking mode.
108108 _imagePickerController.videoExportPreset = AVAssetExportPresetPassthrough;
109109 }
110110 self.result = result;
@@ -269,7 +269,6 @@ - (void)imagePickerController:(UIImagePickerController *)picker
269269 if (videoURL == nil ) {
270270 videoURL = (NSURL *) info[UIImagePickerControllerReferenceURL];
271271 }
272- NSLog (@" has video URL? %@ " , videoURL);
273272 }
274273 [_imagePickerController dismissViewControllerAnimated: YES completion: nil ];
275274 // The method dismissViewControllerAnimated does not immediately prevent
@@ -281,11 +280,9 @@ - (void)imagePickerController:(UIImagePickerController *)picker
281280 }
282281 if (videoURL != nil ) {
283282 if (@available (iOS 11.0 , *)) {
284- NSLog (@" will try to copy resource at asset URL: %@ " , videoURL);
285283 NSString *fileName = [videoURL lastPathComponent ];
286284 NSURL *destination =
287285 [NSURL fileURLWithPath: [NSTemporaryDirectory () stringByAppendingPathComponent: fileName]];
288- NSLog (@" copy detination: %@ " , destination);
289286
290287 // Two different code paths exist for getting accessible real file path,
291288 // even with the same OS version( on iOS 14.3).
@@ -301,32 +298,16 @@ - (void)imagePickerController:(UIImagePickerController *)picker
301298 [[NSFileManager defaultManager ] copyItemAtURL: videoURL toURL: destination error: &error];
302299
303300 if (error) {
304- NSLog (@" failed to copy resource, error: %@ " , error);
305301 self.result ([FlutterError errorWithCode: @" flutter_image_picker_copy_video_error"
306302 message: @" Could not cache the video file."
307303 details: nil ]);
308304 self.result = nil ;
309305 return ;
310- } else {
311- NSLog (@" ok with copying resource, destination: %@ " , destination);
312306 }
313- } else {
314- NSLog (@" no need to copy resource, destination = srouce." );
315307 }
316308 videoURL = destination;
317-
318- // NSNumber *fileSizeValue = nil;
319- // NSError *fileSizeError = nil;
320- // [videoURL getResourceValue:&fileSizeValue
321- // forKey:NSURLFileSizeKey
322- // error:&fileSizeError];
323- // if (fileSizeValue) {
324- // NSLog(@"file size for %@ is %@", videoURL, fileSizeValue);
325- // } else {
326- // NSLog(@"error getting size for url %@ error was %@", videoURL, fileSizeError);
327- // }
328309 } else {
329- NSLog ( @" source not readable, using PhotoKit for acccesing: %@ " , destination);
310+ // PhotoKit for "assets-library://" schema handling.
330311
331312 PHAsset *originalAsset = [FLTImagePickerPhotoAssetUtil getAssetFromImagePickerInfo: info];
332313
@@ -349,11 +330,14 @@ - (void)imagePickerController:(UIImagePickerController *)picker
349330 if ([[NSFileManager defaultManager ] copyItemAtURL: avAsset.URL
350331 toURL: destination
351332 error: &error]) {
352- NSLog (@" successfully copy asset from PhotoKit correctly from %@ to %@ " , avAsset.URL , destination);
353333 weakSelf.result (destination.path );
354334 weakSelf.result = nil ;
355335 } else {
356- NSLog (@" copy asset from PhotoKit from %@ to %@ failed: %@ " , videoURL, destination, error);
336+ self.result ([FlutterError errorWithCode: @" flutter_image_picker_copy_video_error"
337+ message: @" Could not cache the video file."
338+ details: nil ]);
339+ self.result = nil ;
340+ return ;
357341 }
358342 }];
359343
0 commit comments