invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.62k stars 2.2k forks source link

[πŸ›][πŸ”₯] onTokenRefresh is not working in iOS 16 #6846

Closed yushanwebdev closed 1 year ago

yushanwebdev commented 1 year ago

Issue

Currently have an issue with messaging().onTokenRefresh in iOS 16. I cross-check the latest device token using messaging().getToken & already existing Token in my DB. It's different but the onTokenRefresh is not triggering.

My Device Token - e0ztg23QfkxgnTECZR5U1l:APA91bGKZ3rajt1wuqq1lUFtw7V77NB0SrS1LbsL-hHTTnIaIGlo-HcsCbAoZY9ynsUhIaGLsrZu8nI_00RH5WRwy2cSxPkQS6sG5DprdC4MkLao-FhnlksJu6meDxd5HWrR9yOjb17x

DB Token - e0ztg23QfkxgnTECZR5U1l:APA91bHRjYkD0eL0SuvGp2EyDQ1N1g6TwJe5QjD_98G69uYJ1XZXjBjFf34vHb1rAUJDcd1xydVW-G4c8M-MPev2ICWOV9Qau6EX5ZjT5WQSx-K5SnO0uR5VJNcibsxPj4aGOO9msLt6

Component - https://gist.github.com/yushanwebdev/adfcb3ba43441119f3b4fb18e0c843eb

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "blott-native-boilerplate", "description": "React Native Starter Kit, using TypeScript with React Native Navigation", "keywords": [ "react native", "typescript", "starter kit", "redux thunk", "react native navigation", "boilerplate" ], "version": "1.0.0", "author": { "name": "Yushan Fernando", "email": "yushanwebdev@gmail.com", "url": "https://github.com/yushanwebdev" }, "private": false, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "cross-env-shell jest", "ios": "npx react-native run-ios --simulator='iPhone 14'", "android": "npx react-native run-android --variant=Debug", "clean:android": "cd android && ./gradlew clean && ./gradlew :app:bundleRelease && cd ..", "build:android:debug": "./gradlew assembleDebug", "build:android:release": "cd android && ./gradlew assembleRelease && cd ..", "lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .", "prettier": "prettier --ignore-path .gitignore --ignore-path .prettierignore \"**/*.+(js|json|ts|tsx)\"", "format": "yarn run prettier -- --write", "check-format": "yarn run prettier -- --check", "check-types": "npx tsc", "validate": "yarn run lint && yarn run check-format && yarn run check-types", "version": "react-native-version --never-amend", "postinstall": "patch-package" }, "dependencies": { "@notifee/react-native": "^5.7.0", "@react-native-async-storage/async-storage": "1.16.3", "@react-native-firebase/app": "^16.5.0", "@react-native-firebase/crashlytics": "^16.5.0", "@react-native-firebase/dynamic-links": "^16.5.0", "@react-native-firebase/messaging": "^16.5.0", "@shopify/flash-list": "^1.3.0", "@sumsub/react-native-mobilesdk-module": "^1.20.3", "awesome-debounce-promise": "^2.1.0", "crypto-js": "^4.1.1", "judokit-react-native": "3.3.7", "lodash.debounce": "^4.0.8", "lottie-ios": "3.4.1", "lottie-react-native": "^5.1.4", "native-base": "^3.4.13", "react": "^17.0.2", "react-async-hook": "^4.0.0", "react-hook-form": "^7.34.2", "react-native": "^0.66.0", "react-native-camera": "^4.2.1", "react-native-config": "^1.4.6", "react-native-contacts": "^7.0.5", "react-native-device-info": "^10.0.2", "react-native-gesture-handler": "^2.8.0", "react-native-image-picker": "^4.10.0", "react-native-keychain": "yushanwebdev/react-native-keychain#v8", "react-native-linear-gradient": "^2.6.2", "react-native-navigation": "^7.23.1", "react-native-pager-view": "^6.0.0", "react-native-permissions": "^3.6.1", "react-native-qrcode-scanner": "^1.5.5", "react-native-qrcode-svg": "^6.1.2", "react-native-reanimated": "^2.11.0", "react-native-safe-area-context": "^4.4.1", "react-native-svg": "^13.6.0", "react-native-tab-view": "^3.1.1", "react-native-uuid": "^2.0.1", "react-redux": "^7.2.4", "redux": "4.1.0", "redux-thunk": "^2.3.0", "use-constant": "^1.1.1" }, "license": "MIT", "devDependencies": { "@babel/core": "^7.12.9", "@babel/plugin-proposal-class-properties": "^7.3.0", "@babel/preset-env": "^7.3.1", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "@tsconfig/react-native": "^2.0.2", "@types/crypto-js": "^4.1.1", "@types/jest": "^26.0.23", "@types/react": "^17.0.15", "@types/react-native": "^0.64.12", "@types/react-redux": "^7.0.1", "@types/react-test-renderer": "^16.0.3", "@types/redux-logger": "^3.0.8", "@typescript-eslint/eslint-plugin": "^5.33.0", "@typescript-eslint/parser": "^5.33.0", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^10.0.1", "babel-jest": "^26.6.3", "babel-preset-airbnb": "^3.2.0", "babel-preset-react-native": "^4.0.1", "cross-env": "^7.0.3", "eslint": "^7.32.0", "jest": "^25.1.0", "metro-react-native-babel-preset": "^0.66.2", "patch-package": "^6.5.0", "postinstall-postinstall": "^2.1.0", "react-addons-test-utils": "^15.6.2", "react-native-version": "^4.0.0", "react-test-renderer": "^17.0.2", "redux-logger": "^3.0.6", "regenerator-runtime": "^0.13.1", "typescript": "^4.4.4" }, "engines": { "node": ">=10", "npm": ">=6.0.0", "yarn": ">=1.9.2" } } ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": { "crashlytics_disable_auto_disabler": true, "crashlytics_auto_collection_enabled": true, "crashlytics_is_error_generation_on_js_crash_enabled": true, "crashlytics_javascript_exception_handler_chaining_enabled": false } } ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby source 'https://cdn.cocoapods.org/' source 'https://github.com/SumSubstance/Specs.git' require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '11.0' pod 'FirebaseCore', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true target 'SpotApp' do config = use_native_modules! use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => false ) target 'SpotAppTests' do inherit! :complete # Pods for testing end permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications" pod 'Permission-Camera', :path => "#{permissions_path}/Camera" # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. use_flipper!() post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["ONLY_ACTIVE_ARCH"] = "NO" end end end end # target 'SpotApp-tvOS' do # # Pods for SpotApp-tvOS # target 'SpotApp-tvOSTests' do # inherit! :complete # # Pods for testing # end # end ``` #### `AppDelegate.m`: ```objc // N/A ```


Android

Still didn't check

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` info Fetching system and libraries information... System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 83.73 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.1/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm Watchman: 2022.09.26.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: ^17.0.2 => 17.0.2 react-native: ^0.66.0 => 0.66.1 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found info React Native v0.71.1 is now available (your project is running on v0.66.1). info Changelog: https://github.com/facebook/react-native/releases/tag/v0.71.1. info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.66.1. info To upgrade, run "react-native upgrade". ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [x] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `v16.5.0` - **`Firebase` module(s) you're using that has the issue:** - `messaging` - **Are you using `TypeScript`?** - `Y` & `4.4.4`


yushanwebdev commented 1 year ago

@mikehardy can you help me on this issue?

Thank You.

mikehardy commented 1 year ago

I cannot, sorry, this is an unsupported build configuration based on your Podfile contents.

use_frameworks! :linkage => :static is strictly required, based on underlying firebase-ios-sdk requirements

This:


pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true

Is unsupported workaround stuff that I mention is unsupported everywhere I see it. It must not be used.

We can reopen if you have a supported build configuration and still experience issues.

yushanwebdev commented 1 year ago

Okay @mikehardy. Thank You.