NativeScript / NativeScript/plugins

[@nativescript/imagepicker] - app crashes on video selection that is unloaded to iCloud

Open
#497 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
206
Forks
123
Avg merge
2d 1h
Merged PRs (30d)
1

Description

Using @nativescript/imagepicker
When I pick a video that's stored locally it works as expected but if the video is old and is unloaded to iCloud to save device's storage it crashes the app immediately with the following error:

authorizing...
  ***** Fatal JavaScript exception - application has been terminated. *****
  NativeScript encountered a fatal error: Uncaught Error: The file couldn\M-b\M^@\M^Z\M-C\M^D\M-C\M-4t be opened.
  at
  _loop_2(file: src/webpack:/mitch/node_modules/@nativescript/imagepicker/index.ios.js:148:0)
  at (file: src/webpack:/mitch/node_modules/@nativescript/imagepicker/index.ios.js:158:0)
  at timer(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:2405:0)
  at invokeTask(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:406:0)
  at runTask(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:178:0)
  at invokeTask(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:487:0)
  at ZoneTask.invoke(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:476:0)
  at data.args.<computed>(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:2385:0)
  at invoke(file: src/webpack:/mitch/node_modules/@nativescript/core/timer/index.ios.js:54:0)
  at invoke(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:372:0)
  at runGuarded(file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:144:0)
  at (file: src/webpack:/mitch/node_modules/zone.js/fesm2015/zone.js:128:0)
  at TimerTargetImpl.tick(file: src/webpack:/mitch/node_modules/@nativescript/core/timer/index.ios.js:18:0)

and this is how I'm handling video selection:

if (result === "Add video") {
        this.mediaType = "video";
        let videoPicker = imagePickerPlugin.create({
          mode: 'single',
          mediaType: ImagePickerMediaType.Video
        });

        this.startVideoSelection(videoPicker);
      }


---

startVideoSelection(videoPicker) {
    videoPicker
      .authorize()
      .then(() => videoPicker.present())
      .then((selection) => {
        console.log('Selection done: ' + JSON.stringify(selection));

        this.processVideo(selection);
      })
      .catch((err) => {
        console.log(err);
        // this.errorMessage = err;
      });
  }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with @nativescript/imagepicker/index.ios.js around lines 148-158, as identified in the stack trace, and reproduce selection of a video unloaded to iCloud. Done means that this selection no longer crashes the app and the failure is handled through the picker flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.