[iOS] getExpoPushTokenAsync doesn't resolve nor reject

See original GitHub issue

Summary

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
marcato15commented, Jan 21, 2022

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.

0reactions
github-actions[bot]commented, May 1, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS - Expo Notifications.getExpoPushTokenAsync() not ...
expo build:ios --clear-push-cert. I installed the app using testflight on my testdevices, and now I do get a token as expected!
Read more >
Notifications
Fetching a push token takes a long time on iOS. getDevicePushTokenAsync and getExpoPushTokenAsync can sometimes take a long time to resolve on iOS....
Read more >
expo getExpoPushTokenAsync が効かない|島田たつお
[notifications][iOS] getExpoPushTokenAsync doesn't resolve nor reject · Issue #15990 ... OS === 'ios') { const token = (await Notifications.
Read more >
Basics and caveats of Expo-notifications
Be aware that expo-notifications does not work on emulators, so you should ... getExpoPushTokenAsync()).data return token } catch (error) ...
Read more >
Expo-notifications
getExpoPushTokenAsync -- resolves with an Expo push token ... type (string) -- Either ios , android or web . data (string or object)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found