Permissions: function askAsync() never resolves

Edit: The Snack beyond seems to work fine, I think my problem occurs, when I use the askAsync() function from Permissions

I’m very new to expo and these forums, so i hope i’ll get everything right:

I’m running expo sdk 32 and having an issue on opening the camera and the library on any iPhone (device/simulator) so far…
I did not get any error-messages (but I would not wonder if that is my fault). Hours of reading all kinds of forums, etc. I found a Snack on how to properly use the expo-ImagePicker, but on ios the async task to open the camera never gives any results i think, because code written beneath never gets executed. In my environment however, both functions do not return any results. On android everything works perfectly fine, regardless which simulator, emulator or device I’m using.

expo --version: 2.11.6
expo sdk: 32.0.0
snack: (an a bit tweeked version of this awesome snack, hope posting this is ok)

Pls let me know if i did sth wrong with this post, beside that I would love to receave any ideas and help of you,
have a nice day!

Hey @h3nnut!

Thanks for providing all the information, and glad to hear you’re new to Expo! Hope you’re enjoying it

I just tried the example Snack you linked on my iOS device, and both methods worked!
Just be aware that the camera won’t open on a simulator no matter what (because it’s a simulator)

I’m enjoing Expo very much! Thank you very much for the fast reply.

And also thank you for testing it out. I didnt know that there is no camera in ios simulators, sorry about that! I think i will try to use an older expo SDK, this could solve my problem, right?

I don’t think so. What issue exactly are you having with the Snack you linked above (on a physical device)? Because like I said, it works perfectly for me

I think this is my problem! checked my code several times and it seems that the askasync permissions need endless time to finish, so I need to make it a promise. Though I’m running sdk 32, I tried the example on top, but still the same problem…

EDIT: the snack above was fine eventualy it looked like my error but now i think i understand it better. Only launching the ImagePicker.launcheImageLibriaryAsync() function without asking camera_roll permissions also never resolves.

I found out what caused my problem… It seems that ios has problems to open permissions and imagepicker while a modal is active. making onPress on the TouchableHighlight async solved the problem, but I’m not sure why nor what exactly happends there.

<TouchableHightlight onPress={async() => {await openGallery()}}>…
//fixes my problem

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.