NOTE: There are 2 workarounds confirmed working while we fix this. Manually delete a header file from ios/Pods
post pod install or temporarily use @react-native-firebase/[email protected]
Original post follows:
Hi! I installed @react-native-firebase/app and integrated (run successfully). After that installation i installed @react-native-firebase/messaging but im getting error on iOS
Click To Expand
#### `package.json`:
"dependencies": {
"@react-native-firebase/app": "^8.3.1",
"@react-native-firebase/dynamic-links": "^7.4.2",
"@react-native-firebase/messaging": "^7.7.1",
}
# N/A
#### `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:
platform :ios, '10.0'
$FirebaseSDKVersion = '6.13.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
use_native_modules!
target 'bluedot' do
# Pods for bluedot
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-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'
pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'
pod 'Stripe', '~> 19.0.1'
target 'bluedotTests' do
inherit! :search_paths
# Pods for testing
end
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps' , '3.2.0'
pod 'Google-Maps-iOS-Utils', '2.1.0'
use_native_modules!
end
target 'bluedot-tvOS' do
# Pods for bluedot-tvOS
target 'bluedot-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
# N/A
#### `AppDelegate.m`:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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 <GoogleMaps/GoogleMaps.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>
#import <React/RCTLinkingManager.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
[GMSServices provideAPIKey:@"****"]; // add this line using the api key obtained from Google Console
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"bluedot"
initialProperties:nil];
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;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
// N/A
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.15.3
CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Memory: 29.45 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.3/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 16, 23, 24, 25, 26, 27, 28, 29
Build Tools: 28.0.0, 28.0.3, 29.0.2, 29.0.3
System Images: android-16 | ARM EABI v7a, android-24 | Intel x86 Atom_64, android-24 | Google APIs Intel x86 Atom_64, android-25 | Android TV Intel x86 Atom, android-25 | Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom_64, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-screens: 2.0.0-alpha.3
- **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:**
- `0.61.5`
- **`Firebase` module(s) you're using that has the issue:**
- `@react-native-firebase/app`
- `@react-native-firebase/messaging`
- `@react-native-firebase/dynamic-links`
- **Are you using `TypeScript`?**
- `N`
React Native Firebase
and Invertase
on Twitter for updates on the library.Hi @muratclk ! Sorry this is happening - it looks like this #4085 from @davidepalazzo
You mention "you are getting ...", what command produces the error? Can you paste the full error in?
What's the consequence, is the build failing or the app crashing, or is it just a warning?
Possible help for a fix:
https://stackoverflow.com/questions/8815200/receiver-type-for-instance-message-is-a-forward-declaration
https://stackoverflow.com/questions/15719681/receiver-type-for-instance-messages-is-a-forward-declaration-in-xcode-4-6
I'm not sure what the actual fix will be though (sorry), if you could react into node_modules/@react-native-firebase/
directly (likely from within Xcode so it can provide assistance) and try some of the things mentioned, that would help figure out the appropriate course
Alternatively, temporarily using @react-native-firebase/[email protected]
may work for you (it is the last release prior to that PR merge)
what the actual fix will be though (sorry), if you could react into
node_modules/@react-native-firebase/
directly (likely from within Xcode so it can provide assistance) and try so
Thanks for reply. I am getting building error when i press start project on ios simulator. It is a build failing. i couldn't fix with these links.
That's unexpected, the build works as we do lots of E2E testing prior to release and I tested it in https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh as well (which does use AdMob). Can you confirm this still happens after you do npx react-native-clean-project
to blow all your caches away for a truly clean build?
(Actually - I mentioned AdMob up there and that is incorrect, this would be a messaging issue I believe and I may not be testing that...)
Hi @muratclk, did you run pod install --repo-update
within the ios folder after adding the messaging package?
Hi @muratclk, did you run
pod install --repo-update
within the ios folder after adding the messaging package?
Yes i did after every installed firebase package
That's unexpected, the build works as we do lots of E2E testing prior to release and I tested it in https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh as well (which does use AdMob). Can you confirm this still happens after you do
npx react-native-clean-project
to blow all your caches away for a truly clean build?
Yes i ran thiis command npx react-native-clean-project
. It cleaned android, ios, node_modules and pods. but im getting this error still. :(
Okay, this is on my list to investigate as well. Not to stop @davidepalazzo from also checking (as it's his code and he may know immediately) but a bit slower (my list is long, unfortunately...) I will get to it either way. Thanks for your patience
Hi Guys,
I'm also getting the same issue.
ARC semantic issue
Receiver type 'FIRMessagingExtensionHelper' for instance message is a forward declaration
@venkat-waran very sorry for the trouble! If you could try any of the workarounds (referencing the previous release, or the stack overflow possible solutions) and report success / failure or (most helpful!) propose a PR to fix everyone would be grateful. Otherwise this will get high priority attention but even my high priority list is pretty deep so it might not be immediate
Sorry, this is happening guys. The FIRMessagingExtensionHelper
is a class which lives in the FirebaseMessaging framework - here's the link to the docs. Usually, the forward declaration error shows up when the class is missing its import. @mikehardy I'm away at the moment so I don't have access to my computer but I can take a look at it as soon as I'm back tomorrow evening.
I found the problem and solved. I searched "#import "FirebaseMessaging.h" for all files and found there are 2 "FirebaseMessaging.h" in Pods/FirebaseMessaging/ .
First one was this
```/*
And second one was this:
/*
``
So when
#import "FirebaseMessaging.hthis code runs it imports the first one and it doesn't contain
#import
Very interesting! Thanks for reporting a workaround @muratclk
Do I understand correctly that you have actually deleted a file from within the Pods directory, after install?
That's perfectly fine for a workaround, but we should find a way to make the import statement resolve the correct one every time out of the box of course
Very interesting! Thanks for reporting a workaround @muratclk
Do I understand correctly that you have actually deleted a file from within the Pods directory, after install?
That's perfectly fine for a workaround, but we should find a way to make the import statement resolve the correct one every time out of the box of course
Yes i deleted because there were 2 FirebaseMessaging.h
file in Pods/FirebaseMessaging/
and one of them doesn't contain #import <FirebaseMessaging/FIRMessagingExtensionHelper.h>
line
I found the problem and solved. I searched "#import "FirebaseMessaging.h" for all files and found there are 2 "FirebaseMessaging.h" in Pods/FirebaseMessaging/ .
First one was this* Copyright 2017 Google * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import <FirebaseMessaging/FIRMessaging.h>
And second one was this:
/* * Copyright 2017 Google * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import <FirebaseMessaging/FIRMessaging.h> #import <FirebaseMessaging/FIRMessagingExtensionHelper.h>
So when
#import "FirebaseMessaging.h
this code runs it imports the first one and it doesn't contain#import <FirebaseMessaging/FIRMessagingExtensionHelper.h>
When i delete the first "FirebaseMessaging.h", problem solved
The above one also works fine and degrading to @react-native-firebase/[email protected] also works for me. I tried both.
Thanks again! So we have 2 confirmed workarounds (temporarily downgrade, or manually fiddle with Pod headers), that's a big help.
This is still a high priority for me (and @davidepalazzo ) but that info should help anyone else struck by this. We'll get this working out of the box again shortly I am sure
Sorry in advance for anyone else hit by this as we work to solve it permanently
I started experiencing the same after the update. I recalled that during setup I had SDK override in podfile as $FirebaseSDKVersion = '6.13.0'. Removing it and reinstalling pods helped. It started using v6.28.1 and the problem is gone.
Hi @sharpcodepro, I'm working with @mikehardy to solve this problem. We are aware of the issue and are already on the move to get rid of it. Thanks for reporting your workaround though!
That may explain why it hasn't reproduced in the E2E tests even though they are in fact referencing the new code https://github.com/invertase/react-native-firebase/blob/18b4740f3991c5efd78a687f24839f4ae917b1c6/tests/package.json#L22 as they are also on 6.28.1 https://github.com/invertase/react-native-firebase/blob/18b4740f3991c5efd78a687f24839f4ae917b1c6/tests/ios/Podfile#L7
I've submitted a PR for this. Hope this helps.
https://github.com/invertase/react-native-firebase/pull/4119
Thanks for the PR @acro5piano - have published this, could you try this version: @react-native-firebase/[email protected]
@Salakar I've tried v7.7.2 and works well. Thanks for releasing!
Love the collaboration here - thanks to @davidepalazzo for contributing a real improvement for everyone and @acro5piano for patching it up (no progress without a little pain :-) ) - this should be a big help for the out-of-the-box notification experience for people that don't need a full notification package
Most helpful comment
I found the problem and solved. I searched "#import "FirebaseMessaging.h" for all files and found there are 2 "FirebaseMessaging.h" in Pods/FirebaseMessaging/ .
First one was this
```/*
*
*
*
*/
import
/*
*
*
*
*/
import
import
``` When i delete the first "FirebaseMessaging.h", problem solved
So when
#import "FirebaseMessaging.hthis code runs it imports the first one and it doesn't contain
#import