Describe your issue here
I'm migrating our React Native app to use Firebase v6, currently on v5. On Android, I ran into very few issues following the guide here: https://rnfirebase.io/migrating-to-v6.
On iOS, on the other hand, I've run into an issue I cannot get past. When I try to build the app (either on the command line with yarn
or through Xcode), I get the error RNFirebaseNotifications.h file not found
in AppDelegate.m
. I understand that the notifications package is no longer used, which is why this error is so dumbfounding. I've seen similar issues posted, but none refer to this exact scenario where the build process is failing because of now-defunct RN Firebase artifacts.
Issue definitely seems to be that AppDelegate.m
is importing a nonexistent package, but I figured the installation process would update this file for iOS. Is there a part of the process I'm missing? Completely uninstalling Firebase and starting from scratch (clearing packages, caches, etc) does not work, as even then the build process fails looking for Firebase.h
.
Click To Expand
#### `package.json`:
...
"dependencies": {
"@react-native-firebase/app": "^6.4.0",
"@react-native-firebase/messaging": "^6.4.0",
"axios": "^0.19.2",
"child_process": "^1.0.2",
"jetifier": "^1.6.1",
"jsc-android": "^241213.1.0",
"jwt-decode": "^2.2.0",
"moment": "^2.22.2",
"prop-types": "^15.7.2",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-actionsheet": "^2.4.2",
"react-native-config": "luggit/react-native-config#master",
"react-native-device-info": "^3.1.4",
"react-native-elements": "^1.0.0",
"react-native-gesture-handler": "^1.4.1",
"react-native-image-crop-picker": "0.25.2",
"react-native-image-picker": "^1.1.0",
"react-native-image-progress": "^1.1.1",
"react-native-image-zoom-viewer": "^2.2.26",
"react-native-modal": "^11.5.3",
"react-native-modal-datetime-picker": "^7.6.0",
"react-native-modal-selector": "^1.0.3",
"react-native-parsed-text": "^0.0.21",
"react-native-progress": "^3.6.0",
"react-native-screens": "^2.0.0-beta.13",
"react-native-snap-carousel": "^3.8.0",
"react-native-vector-icons": "^6.6.0",
"react-native-webview": "^9.1.0",
"react-navigation": "^3.11.0",
"react-redux": "^7.1.0",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0",
"redux-saga": "^1.0.4",
"reduxsauce": "^1.1.0",
"seamless-immutable": "^7.1.3",
"socket.io-client": "^2.1.1"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/preset-flow": "^7.0.0",
"@babel/runtime": "^7.6.2",
"babel-eslint": "^9.0.0",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0",
"reactotron-react-native": "^3.6.4",
"reactotron-redux": "^3.1.1"
},
...
#### `firebase.json` for react-native-firebase v6:
# N/A
### iOS
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'Auxxit' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Auxxit
pod 'Fabric'
pod 'Crashlytics', '~> 3.13'
pod 'FBLazyVector', :path => '../node_modules/react-native/Libraries/FBLazyVector'
pod 'FBReactNativeSpec', :path => '../node_modules/react-native/Libraries/FBReactNativeSpec'
pod 'RCTRequired', :path => '../node_modules/react-native/Libraries/RCTRequired'
pod 'RCTTypeSafety', :path => '../node_modules/react-native/Libraries/TypeSafety'
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => '../node_modules/react-native/ReactCommon'
pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native/ReactCommon'
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
target 'AuxxitTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'Auxxit-tvOS' do
inherit! :search_paths
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Auxxit-tvOS
target 'Auxxit-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
#### `AppDelegate.m`:
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>
#import <Firebase.h>
#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
[Fabric with:@[[Crashlytics class]]];
[FIRApp configure];
[RNFirebaseNotifications configure];
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Auxxit"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
}
@end
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`:
// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->
Click To Expand
**`react-native info` output:** System: OS: macOS 10.14.6 CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz Memory: 2.53 GB / 8.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 12.5.0 - /usr/local/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 IDEs: Xcode: 11.2.1/11B53 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5
OUTPUT GOES HERE
- **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:**
- `6.4.0`
- **`Firebase` module(s) you're using that has the issue:**
- `Messaging/Notifications`
- **Are you using `TypeScript`?**
- `N`
React Native Firebase
and Invertase
on Twitter for updates on the library.Sounds like you have some left overs locally - try running https://www.npmjs.com/package/react-native-clean-project to clean everything and re-install
hello,
please take look this:
https://rnfirebase.io/migrating-to-v6#cloud-messaging
[ios] The manually added RNFirebaseMessaging usages in your AppDelegate files are no longer required - you can safely remove them.
i think also the same for RNFirebaseNotifications.h
it is work for mae after remove all about [RNFirebaseNotifications] and [RNFirebaseMessaging]
@AnasAlsaadi Manually removing those references worked! Removing both RNFirebaseMessaging
and RNFirebaseNotifications
was the key.
Thanks all for the quick responses.
Hi @davidvorona,
Can you share your AppDelegate.m
file? I removed the RNFirebaseMessaging.h
and RNFirebaseNotifications.h
imports but it didn't work for me.
can you share your AppDelegate.m anyone, im having trouble also with this issue
@janpaulalmanoche I don't believe there should be anything like that in the file: https://rnfirebase.io/migrating-to-v6#notifications
To see what a clean modern react-native-firebase integration looks like (and to see with comments exactly how to create one) read + run this script: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh
@janpaulalmanoche I don't believe there should be anything like that in the file: https://rnfirebase.io/migrating-to-v6#notifications
To see what a clean modern react-native-firebase integration looks like (and to see with comments exactly how to create one) read + run this script: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh
will check right away. thank you
Most helpful comment
hello,
please take look this:
https://rnfirebase.io/migrating-to-v6#cloud-messaging
[ios] The manually added RNFirebaseMessaging usages in your AppDelegate files are no longer required - you can safely remove them.
i think also the same for RNFirebaseNotifications.h
it is work for mae after remove all about [RNFirebaseNotifications] and [RNFirebaseMessaging]