question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Imagepicker on iOS sometimes gets stuck at .present()

See original GitHub issue

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).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tingfong214commented, Jul 26, 2019

I think the problem still occurs with version 6.2.0 with tns version 5.2.0

2reactions
ghostcommented, Mar 7, 2019

Hello, @DimitarTodorov I confirm it is working as expected now. Thank you all very much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ios - UIImagePickerController freezes when selecting a picture
I am trying to allow users to modify their profile image. I have implemented the correct code and entered the correct call in...
Read more >
Customizing an Image Picker Controller - Apple Developer
Manage user interactions and present custom information when taking pictures by adding an overlay view to your image picker.
Read more >
How to Use UIImagePickerController for a Camera and Photo ...
We will put a photo into an UIImageView when we first use the image, and doing so on an iPad is easier than...
Read more >
Ios – UIImagePicker allowsEditing stuck in center - iTecNote
Anyone know why this would be the case? It only happens when the source is from the camera, not the library. Edit: Some...
Read more >
glaxy a 21 crash when pick image from camera flutter - You.com
Follow. answered Jun 20, 2021 at 20:10. German Ruelas. 1. Add a comment. 0. in case of iOS 14 or later using image...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found