GitToTheHub commented on code in PR #942:
URL:
https://github.com/apache/cordova-plugin-camera/pull/942#discussion_r2688102463
##########
src/ios/CDVCamera.m:
##########
@@ -396,17 +396,29 @@ - (void)picker:(PHPickerViewController*)picker
didFinishPicking:(NSArray<PHPicke
// Check if it's a video
if ([pickerResult.itemProvider
hasItemConformingToTypeIdentifier:UTTypeMovie.identifier]) {
- [pickerResult.itemProvider
loadFileRepresentationForTypeIdentifier:UTTypeMovie.identifier
completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
+ // Writes a copy of the data to a temporary file. This file will
be deleted
+ // when the completion handler returns. The program should copy or
move the file within the completion handler.
+ [pickerResult.itemProvider
loadFileRepresentationForTypeIdentifier:UTTypeMovie.identifier
+
completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
if (error) {
- CDVPluginResult* result = [CDVPluginResult
resultWithStatus:CDVCommandStatus_ERROR messageAsString:[error
localizedDescription]];
+ CDVPluginResult* result = [CDVPluginResult
resultWithStatus:CDVCommandStatus_ERROR
+
messageAsString:[error localizedDescription]];
[weakSelf.commandDelegate sendPluginResult:result
callbackId:callbackId];
weakSelf.hasPendingOperation = NO;
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
NSString* videoPath = [weakSelf createTmpVideo:[url path]];
- CDVPluginResult* result = [CDVPluginResult
resultWithStatus:CDVCommandStatus_OK messageAsString:videoPath];
+ CDVPluginResult* result = nil;
+
+ if (videoPath == nil) {
+ result = [CDVPluginResult
resultWithStatus:CDVCommandStatus_IO_EXCEPTION
+ messageAsString:@"Failed to
copy video file to temporary location"];
+ } else {
+ result = [CDVPluginResult
resultWithStatus:CDVCommandStatus_OK messageAsString:videoPath];
+ }
+
[weakSelf.commandDelegate sendPluginResult:result
callbackId:callbackId];
weakSelf.hasPendingOperation = NO;
Review Comment:
Added it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]