Imagepicker on iOS sometimes gets stuck at .present()
See original GitHub issueWhich 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.
- run
tns createto generate a project. Generate a plain TypeScript project, with the Hello World template. The problem also occurs with Angular. - install the plugin with the simple
tns plugin add nativescript-imagepicker - add the permission lines in the Info.plist file
<key>NSPhotoLibraryUsageDescription</key>
<string>Description text goes here</string>
- 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);
});
}
- run the app with a simple
tns run ios - tap the button to pop the imagepicker
- 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:
- Created 5 years ago
- Reactions:1
- Comments:17 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think the problem still occurs with version 6.2.0 with tns version 5.2.0
Hello, @DimitarTodorov I confirm it is working as expected now. Thank you all very much.