apache / apache/cordova-plugin-camera

[iOS - iPad] App crashes if video transcoding is interrupted

Open
#545 0 comments 0 reactions 0 assignees View on GitHub
bug has-pr platform: ios
Dominant language
Objective-C
Stars
976
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

## Problem

In iOS, when one selects a video from the gallery, a transcoding/compression process must be carried out. In iPhone one cannot interrupt or cancel this process, but in iPad you do: since the gallery navigation appears inside a pop-up, you can click anywhere outside the pop-up or the back button. If you do so, the app crashes.

### What is expected to happen?

The transcoding process is interrupted, an exception is captured and properly emitted in js.

### What does actually happen?

The app crashes becasue of an uncaptured exception happens in the native code:

```
2020-01-13 18:07:44.521068+0100 MyApp[1556:320750] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSFileManager copyItemAtPath:toPath:options:error:]: source path is nil'
*** First throw call stack:
(0x1c239bea0 0x1c156da40 0x1c22a2674 0x1c2d813fc 0x10090f1dc 0x10090f9c0 0x10090f5f8 0x1ee8ee30c 0x1ee8edc00 0x101c03824 0x101c04dc8 0x101c12a78 0x1c232bdd0 0x1c2326c98 0x1c23261cc 0x1c459d584 0x1eef65054 0x1009080e4 0x1c1de6bb4)
libc++abi.dylib: terminating with uncaught exception of type NSException
```

## Information

Tested in iOS 12 and 13.

### Command or Code

The app crashes and the catch is never reached:

```
fileUri = await this.camera.getPicture(options).then((fileURI) => {
console.log(fileURI);
return fileURI;
}).catch((error) => {
console.error(error)
});
```

### Environment, Platform, Device

iPad, iOS versions 12 and 13.

### Version information

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.