This is a very straightforward vanilla implementation, including a firebase.json as follows in the project root, as described here: https://rnfirebase.io/messaging/usage#auto-registration-ios
Regardless, I still get the following warning:
Usage of "messaging().registerDeviceForRemoteMessages()" is not required. You only need to register if auto-registration is disabled in your 'firebase.json' configuration file via the 'messaging_ios_auto_register_for_remote_messages' property.
Click To Expand
#### `package.json`:
"@react-native-firebase/analytics": "^7.6.2",
"@react-native-firebase/app": "^8.4.2",
"@react-native-firebase/dynamic-links": "^7.5.3",
"@react-native-firebase/iid": "^7.4.3",
"@react-native-firebase/in-app-messaging": "^7.5.1",
"@react-native-firebase/messaging": "^7.8.6",
...
"react-native": "0.63.2",
#### `firebase.json` for react-native-firebase v6:
{
"react-native": {
"messaging_ios_auto_register_for_remote_messages": false
}
}
Redux implementation:
...
import Messaging from '@react-native-firebase/messaging'
...
const refreshNotifications = () => async(dispatch, getState) => {
...
await Messaging().registerDeviceForRemoteMessages()
const token = await Messaging().getToken()
...
}
### iOS
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:
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'
workspace 'App'
target 'App' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'
target 'Tests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
#### `AppDelegate.m`:
...
#import "Firebase.h"
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
...
return YES;
}
Click to expand
**`react-native info` output:**
System:
OS: macOS 10.15.6
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 260.61 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
Yarn: Not Found
npm: 6.14.5 - ~/.nvm/versions/node/v12.14.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK:
API Levels: 23, 27, 28, 29
Build Tools: 28.0.3, 29.0.0, 29.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_211 - /usr/bin/javac
Python: 2.7.16 - /Users/<user>/.pyenv/shims/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
- **Platform that you're experiencing the issue on**:
- [x] iOS
- [ ] Android
- [ ] **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:**
- `^8.4.2`
- **`Firebase` module(s) you're using that has the issue:**
- `@react-native-firebase/messaging@^7.5.1`
- **Are you using `TypeScript`?**
- `N`
Hello @todesignandconquer, im curious about your use case. Why do you need to disable the auto registration then register yourself to get token?
@TommyLeong I want to defer requesting/registering the Messaging token until after a user has created an account.
Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
Most helpful comment
@TommyLeong I want to defer requesting/registering the Messaging token until after a user has created an account.