Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Feb 18, 2019 · 17 comments
Closed

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

ghost opened this issue Feb 18, 2019 · 17 comments

Comments

@ghost
Copy link

ghost commented Feb 18, 2019

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

@ghost
Copy link
Author

ghost commented Feb 18, 2019

I've also had it occur on the sample demo provided in this repo. I just built and ran the demo, without touching any file. Tested on an iPhone 7 emulator. It worked fine initially for over 10 sequential image selection, then I closed the app (hit home button twice and slide the app up) and started it again. It immediatly broke, I couldn't pick an image nor cancel the imagepicker.

@patrikengborg
Copy link

patrikengborg commented Feb 20, 2019

Same problem here. I haven't noticed this problem prior to upgrading to NS 5.2.
Just as @TsotneShonia points out, it seems to be completely random.

@raphaelnm
Copy link

Same problem here on iphone 8 Plus (iOS 12.1.4)

@DickSmith
Copy link

Same problem as well after updating to {N} 5.2.

@NickIliev
Copy link
Contributor

+1 reported via t-1397525.

I've reproduced the issue using this basic demo and the steps despised by @TsotneShonia .

On my side, it seems that the issue is reproducible on iPad with iOS 12.1.4 (I was not able to hit the issue on iPhone X, iPhone XR). The result is that hitting the CANCEL is not working (but again as @TsotneShonia noticed there is the visual effect of tapping the button - its just not closing the modal)

@ghost
Copy link
Author

ghost commented Feb 27, 2019

Thanks everyone for confirming the issue, adding details to it, and bringing a fix.

However, I must report that the issue persists for me, despite the fix. It now behaves slightly differently.

First, I can no longer reproduce it on simulators, only on devices.
I reproduced it on both an iPhone 7 with iOS 12.1.4 and iPhone 5S with iOS 11.3.1. I used the vanilla demo provided in this repo, with the commit e8fd440.

Second, it can no longer break while it's being used. If it works on the first attempt, it will keep working until I close the app. But it can still "break" on the first usage.
According to my tests, there's roughly one chance out of 3 that the image picker starts broken. The symptoms look like they are the same.

@JuanDeLeon
Copy link

Same for me, using NS 5.2 and iPhone 8 with iOS 12.1.4
After updating plugin, it worked every time in simulator.
However, for me it is breaking 100% of the times in the device.

@DimitarTodorov
Copy link
Contributor

Fixed with latest release of [email protected]

@JuanDeLeon
Copy link

JuanDeLeon commented Feb 28, 2019

I'm definitely still getting this issue on device, but less often. Trying to figure out when/why, but it's pretty random.

@tbozhikov tbozhikov reopened this Mar 1, 2019
@ghost
Copy link
Author

ghost commented Mar 1, 2019

Same here, it still occurs, even with [email protected].

@darxmac
Copy link

darxmac commented Mar 3, 2019

Ok, the crash was a one-time thing, but i also get the hang when picking in 6.1.1

@DimitarTodorov
Copy link
Contributor

Hello, @TsotneShonia
We've just published 6.1.2 to npm with fix for the issue.
Can you confirm on your side that it is fixed and reply to this thread in order to close the issue?

Regards

@ghost
Copy link
Author

ghost commented Mar 7, 2019

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

@tingfong214
Copy link

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

@b02505048
Copy link

Same here, the problem still occurs occasionally @6.2.0 ...

@Universi
Copy link

Same issue with @7.1.0

@francislow
Copy link

francislow commented Dec 18, 2020

I ran into the same issue with imagepicker version 7.1.0 on iphone 11 emulator. It was able to run only once after restarting the application. I added a delay between authorize() and present() and it solved the issue for me.
Screenshot 2020-12-18 at 9 40 25 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests