Skip to content

Imagepicker on iOS sometimes gets stuck at .present() #251

Closed
@ghost

Description

Which platform(s) does your issue occur on?

  • iOS 12.1
  • Emulator : iPhone 7, iPhone X, iPhone XR - iOS 12.1
  • Devices : iPhone 7 - iOS 12.1.4

Please, provide the following version numbers that your issue occurs with:

  • CLI: 5.2
  • Cross-platform modules: 5.2
  • Runtime(s): 5.2 ( iOS ) (works fine on Android with 5.2)
  • Plugin(s): nativescript-imagepicker is at ^6.1.0, everything else comes from tns create
  • Built on : macOS Mojave 10.14.3 with XCode 10.1

Please, tell us how to recreate the issue in as much detail as possible.

  1. run tns create to generate a project. Generate a plain TypeScript project, with the Hello World template. The problem also occurs with Angular.
  2. install the plugin with the simple tns plugin add nativescript-imagepicker
  3. add the permission lines in the Info.plist file
<key>NSPhotoLibraryUsageDescription</key>
<string>Description text goes here</string>
  1. in the main-view-model.ts file, add the import line :
import * as imagepicker from "nativescript-imagepicker";

and replace the onTap() function with this :

    onTap() {
        let context = imagepicker.create({mode: "single"});
        context
            .authorize()
            .then(function () {
                return context.present();
            })
            .then(function (selection) {
                console.log("selected image");
            }).catch(function (e) {
                console.log("caught : ", e);
            });
    }
  1. run the app with a simple tns run ios
  2. tap the button to pop the imagepicker
  3. pick an image or hit the "cancel" button if possible.

Doing steps 6 and 7 repeatedly will break the feature and make the imagepicker stuck. You can no longer pick an image (tapping it does nothing) nor can you go back. The "cancel" button gives a visual feedback on being tapped but does nothing. The user is forced to close the app.

Nothing is displayed in the console.
Sometimes, "if you're lucky", it breaks on the first attempt. Sometimes, 2nd, 4th, 5th. Sometimes it works even after picking 20 images. In those cases, restart the app on the device or emulator.
Usually it breaks around the 4th.
This also occurs in "multiple" selection mode. Images can be selected but the "done" button gets stuck instead (like the "cancel" button).

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions