pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 584 forks source link

Calling showOpenWithDialog on iOS without Position values results in a crash #295

Closed JamesCrowMedia closed 4 years ago

JamesCrowMedia commented 4 years ago

Expected Behaviour

When calling showOpenWithDialog without the optional object, the share sheet should open correctly.

Actual Behaviour

A crash due to a NSInvalidArgumentException.

Reproduce Scenario (including but not limited to)

I found this issue with an Ionic project, but I don't think it would be limited to that wrapper.

Steps to Reproduce

Call showOpenWithDialog in a iOS app without providing a position option.

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Xcode 11 iOS 13.1.12

Cordova CLI info

cordova info

Here is the output: cordova-lib@9.0.1 with: cordova-common@3.2.1 cordova-create@2.0.0 cordova-fetch@2.0.1 cordova-serve@3.0.0

Environment:
    OS: darwin
    Node: v10.11.0
    npm: 6.8.0

Plugin version

cordova plugin version | grep cordova-plugin-file-opener2

Here is the output: cordova-plugin-file-opener2 3.0.1 "File Opener2"

Sample Code that illustrates the problem

// (Using the Ionic Native wrapper)
this.fileOpener.showOpenWithDialog(filePath, 'text/csv');

Logs taken while reproducing problem

2020-05-14 18:26:32.475633-0500 <app name>[3772:4930091] -[NSNull objectAtIndex:]: unrecognized selector sent to instance 0x1e2d879a0
2020-05-14 18:26:32.476801-0500 <app name>[3772:4930091] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull objectAtIndex:]: unrecognized selector sent to instance 0x1e2d879a0'
*** First throw call stack:
(0x1a630498c 0x1a602d0a4 0x1a620843c 0x1a6308e08 0x1a630abec 0x10273e180 0x102909828 0x10290ac04 0x102918c64 0x1a62823c4 0x1a627d3b8 0x1a627c8bc 0x1b00e8328 0x1aa3126d4 0x1025f2368 0x1a6107460)
libc++abi.dylib: terminating with uncaught exception of type NSException