[iOS] getExpoPushTokenAsync doesn't resolve nor reject
See original GitHub issueSummary
Both getExpoPushTokenAsync and getDevicePushTokenAsync method from expo-notifications (0.14.0) return a promise that never resolves nor rejects.
It only affects iOS (physical iPhone 6s), works fine on Android.
Everything push notif related is already setup for both platforms, I successfully receive push notification from another service (Intercom).
The device is connected to internet, I tried putting in a sim card, rebooting it but nothing seems to work.
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
bare
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
No response
Environment
Expo CLI 5.0.3 environment info: System: OS: macOS 11.6 Shell: 5.8 - /bin/zsh Binaries: Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node Yarn: 1.22.11 - /usr/local/bin/yarn npm: 6.14.15 - ~/.nvm/versions/node/v14.17.6/bin/npm Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: API Levels: 28, 29, 30 Build Tools: 29.0.2, 30.0.2 System Images: android-26 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom Android NDK: 23.0.7123448-beta1 IDEs: Android Studio: 4.1 AI-201.8743.12.41.6953283 Xcode: 13.1/13A1030d - /usr/bin/xcodebuild npmPackages: babel-preset-expo: 8.5.1 => 8.5.1 expo: ^43.0.0 => 43.0.1 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.2 => 0.64.2 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: expo-cli: 5.0.3 Expo Workflow: bare
Reproducible demo
import * as Notification from 'expo-notifications';
const getExpoToken = () => {
try {
const currentPermissions = await Notification.getPermissionsAsync();
if (!currentPermissions.granted) {
const permissions = await Notification.requestPermissionsAsync();
if (!permissions.granted) return;
}
console.log('reached');
const expoPushToken = await Notification.getExpoPushTokenAsync({
experienceId: '@myAccount/mySlug'
});
console.log('never reached');
return expoPushToken
} catch {
console.log('never reached');
}
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Related StackOverflow Question
I’m encountering this same error with
getDevicePushTokenAsync. Was trying to move to this package from https://github.com/zo0r/react-native-push-notification. Notification registration worked perfectly before but just hangs and never resolves or rejects when I try to get a device token. I’m using this in a bare setup and not using expo notifications for anything. I’m testing it on my iphone 12 pro that uses notifications fine with the previous library but does literally nothing (not even errors) when I try to use this library.@dqii Forgive me if I’m misunderstanding your problem, but I’m not sure your issue is related since you are dealing with android notifications and this is specifically an error on iOS.
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.