expo: [notifications][iOS] getExpoPushTokenAsync doesn't resolve nor reject
Summary
After upgrade from Expo@43 to Expo@44 getExpoPushTokenAsync doesn’t resolve nor reject on iOS (iPhone 8 (iOS: 15)).
After long debugging it is due to @react-native-firebase/auth package - uninstalling this package makes getExpoPushTokenAsync to return ExpoPushToken
I’m not sure if it should be reported to @react-native-firebase/auth issues or here - but I think it is regression around Expo44 upgrade, because on Expo43 before going thru’ upgrade process everything was working okay (followed upgrade steps from https://blog.expo.dev/expo-sdk-44-4c4b8306584a under Bare workflow section)
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 12.1 Shell: 5.8 - /bin/zsh Binaries: Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node npm: 8.1.2 - ~/.nvm/versions/node/v14.17.3/bin/npm Watchman: 2021.06.07.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.2 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 IDEs: Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild npmPackages: expo: ^44.0.0 => 44.0.5 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 expo-notifications: ~0.14.0 expo-device: ~4.1.0 @react-native-firebase/app: 14.2.1 @react-native-firebase/auth: 14.2.1 npmGlobalPackages: eas-cli: 0.41.0 expo-cli: 5.0.3 Expo Workflow: bare
Reproducible demo
- Create bare Expo project
- Install
expo-notifications(and go thru’ its configuration steps like generating Push Notification Key credential etc - https://github.com/expo/expo/tree/master/packages/expo-notifications#installation-in-bare-react-native-projects) - Install
@react-native-firebase/app(and go thru’ its configuration steps - https://rnfirebase.io/) - Install
@react-native-firebase/auth(and go thru’ its configuration steps - https://rnfirebase.io/auth/usage) - Install
expo-device - Update main App.jsx (or App.tsx) file with code from https://docs.expo.dev/push-notifications/overview/#usage BUT pass
experienceIdtogetExpoPushTokenAsyncmethod and replaceConstants.isDevicewithDevice.isDevice(fromexpo-device) cd ios && pod install- Run
expo run:ios --device --no-build-cache getExpoPushTokenAsyncdoesn’t resolve nor reject- Uninstall
@react-native-firebase/auth cd ios && rm -rf Pods && pod install- Run
expo run:ios --device --no-build-cache getExpoPushTokenAsyncresolves with ExpoPushToken
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 21 (1 by maintainers)
Commits related to this issue
- [templates] workaround expo-notifications broken when there's firebase sdk (#17201) # Why from ios firebase sdk `[FIRApp configure];`, this call will do the swizzling internally. they use it to in... — committed to expo/expo by Kudo 2 years ago
- [templates] workaround expo-notifications broken when there's firebase sdk (#17201) # Why from ios firebase sdk `[FIRApp configure];`, this call will do the swizzling internally. they use it to inte... — committed to expo/expo by Kudo 2 years ago
close this issue via #17201 and will include this change in sdk 45. we are going to release sdk 45 beta recently.
Any updates on this? Facing the same issue on SDK49 😢 the
getExpoPushTokenAsynccall doesn’t resolve or reject for IOSMaybe it gonna help someone who run into this issue and it is still issue for them even on Expo@45 After migrating to AppDelegate.mm for RN@68 you need to update your AppDelegate.mm with changes from commit https://github.com/expo/expo/commit/e95a20416a5f8f88de5875ee9ba7d45cac084423
I think it is also worth take a look on whole https://github.com/expo/expo/blob/e95a20416a5f8f88de5875ee9ba7d45cac084423/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.mm as changes from React Native Upgrade Helper can produce extra issues (for example https://github.com/expo/expo/blob/e95a20416a5f8f88de5875ee9ba7d45cac084423/templates/expo-template-bare-minimum/ios/HelloWorld/AppDelegate.mm#L46 this line has to be in Expo style not in the one that React Native suggest
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"main", nil);)I too was plagued with this problem. I suspect the @react-native-firebase package is affected, but this package is required and cannot be removed. Since I had no choice, I did the following to work around this problem
This solution seems to be working so far. I have attached the actual source for your reference.
Note that this will not work in the simulator and must be checked on the actual device.
having the same issue, took hours to figure out it wasnt my api calls. is there a work around?
I have same issue in latest version of expo as well as @react-native-firebase/app
Thank you for the post. I’m running into the same problem. Looks like this might be a recent regression after upgrading from SDK42 to SDK44. With SDK44,
getDevicePushTokenAsyncjust hangs forever. When I tried to run our older build based on SDK42, it resolved immediately. I know the documentation says that it’s due to Apple server being slow (https://github.com/expo/expo/tree/master/packages/expo-notifications#fetching-a-push-token-takes-a-long-time-on-ios) and we just need to wait, looks like there is more to it.Edit: can confirm that removing
@react-native-firebase/authfixed it. Thank you yerevin!