Permissions.askAsync never resolves on iOS Standalone app
See original GitHub issueWith out recent app release, we have found an apparent bug in Expo in the standalone app which caused Apple to reject the submission. It turns out that the Pemissions.askAsync is often not resolving the promise when the user clicks “Allow” or “Don’t Allow” on the native dialog popup.
We were able to resolve this in two ways:
- Change the screen automatically in the background and don’t wait for a resolved response.
- Use a timeout around the permissions dialog (calling Permissions.getAsync to attempt to get the response).
Ensure the promise resolved with a timeout:
Note: You should probably not let the UI wait for this response.
askNotificationPermissions_withTimeout = () => {
// NOTE: Permissions.askAsync seems to never resolve sometimes, so using a timeout to check status
return new Promise((resolve, reject) => {
const timeoutId = setTimeout(async () => {
const { status } = await Permissions.getAsync(
Permissions.NOTIFICATIONS
);
resolve(status === 'granted');
}, 5000);
const promise = Permissions.askAsync(
Permissions.NOTIFICATIONS
);
promise.then(r => {
clearTimeout(timeoutId);
const { status } = r;
resolve(status === 'granted');
});
});
};
Context
- Expo SDK 24.0.0
- iOS Standalone
Issue Analytics
- State:
- Created 6 years ago
- Comments:37 (9 by maintainers)
Top Results From Across the Web
Expo 29.0 on iOS is no longer resolving Permissions.askAsync ...
In Expo 29.0 SDK it appears that the NOTIFICATIONS permission does not ... The above code never resolves in a stand alone iOS...
Read more >Permissions.askAsync(Permissions.CAMERA) always denied ...
I have encountered a similar problem with the expo-av microphone permissions. In the expo client the permissions work flawlessly but when I ...
Read more >How to use the expo-permissions.NOTIFICATIONS function in ...
To help you get started, we've selected a few expo-permissions. ... Android remote notification permissions are granted during the app // install, ...
Read more >Expo SDK 41 - DEV Community
If you built a standalone app previously, remember that you'll need to create a new build in order to update the SDK version....
Read more >react-native-permissions - npm
An unified permissions API for React Native on iOS, Android and Windows ... If your company uses it in a production app, consider...
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
Hi, we just ran into the same issue with the latest version of Expo. Here are the steps to reproduce the issue:
askAsync
askAsync
At that point, the app hangs waiting for the promise
askAsync
returns to resolve.@brentvatne @bbarthec just to note: this issue was re-introduced in
'expo-permissions'
(at least 6.0.0).