react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

🔥 'FirebaseCore/FirebaseCore.h' file not found

Open kyle-ssg opened this issue 7 years ago • 24 comments

Issue

Every other build I keep getting 'FirebaseCore/FIRAnalyticsConfiguration.h' file not found. I keep going through the process of cleaning Pods folder and reinstalling node modules but this keeps happening.


Project Files

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'

target 'boilerplate' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  use_frameworks!

  # Pods for boilerplate
  pod 'Branch'
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'FBSDKLoginKit'
  pod 'libPusher', '1.6.1'
  pod 'GoogleSignIn', '~> 4.2.0'
  pod 'Analytics/Segmentio'
  pod 'Firebase/Core', '~> 5.15.0'
  pod 'Firebase/Messaging', '~> 5.15.0'
end

AppDelegate.m:

//Standard RN
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLinkingManager.h>

//REACT_NATIVE_BRANCH
#import <react-native-branch/RNBranch.h>

//REACT_NATIVE_FABRIC
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>

//REACT_NATIVE_FIREBASE
#import <Firebase.h>

//REACT_NATIVE_NAVIGATION
#import <ReactNativeNavigation/ReactNativeNavigation.h>

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import "RNGoogleSignin.h"

//Segment
#import "SEGAnalytics.h"

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  
  //REACT_NATIVE_BRANCH
  //[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES]; // <-- add this

  //REACT_NATIVE_FABRIC
 // [Fabric with:@[[Crashlytics class]]];

  //REACT_NATIVE_FUREBASE
  [FIRApp configure];
  [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
  
  BOOL debugMode = NO;
  
  #ifdef DEBUG
    debugMode = YES;
  #endif
  
  if (debugMode) {
    [SEGAnalytics setupWithConfiguration:[SEGAnalyticsConfiguration configurationWithWriteKey:@"commentedout"]];
  } else {
    [SEGAnalytics setupWithConfiguration:[SEGAnalyticsConfiguration configurationWithWriteKey:@"CommentedOut"]];
  }
  
  
  NSURL *jsCodeLocation;
  
  for (NSString* family in [UIFont familyNames])
  {
    NSLog(@"%@", family);
    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
      NSLog(@" %@", name);
    }
  }

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

  //REACT_NATIVE_NAVIGATION
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  self.window.backgroundColor = [UIColor whiteColor];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];


  
  return YES;
}

  
  // Facebook/Google/Branch.io URL handling
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  
  //if ([RNBranch.branch application:application openURL:url sourceApplication:sourceApplication annotation:annotation]) {
   // return YES;
//  }
  
  if ([RNGoogleSignin application:application
                          openURL:url
                sourceApplication:sourceApplication
                       annotation:annotation
       ]) {
    return YES;
  }
  if ([[FBSDKApplicationDelegate sharedInstance] application:application
                                                     openURL:url
                                           sourceApplication:sourceApplication
                                                  annotation:annotation
       ]) {
    return YES;
  }
    
  return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
  
@end


Environment

  • 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
  • If known, the version of the platform are you experiencing the issue on:
    • ADD_SOMETHING_HERE e.g. iOS 10 or Android API 28
  • Operating System:
    • [x] MacOS, version: N/A
    • [ ] Windows, version: N/A
    • [ ] Other, please specify: N/A
  • Build Tools:
    • XCode Version 10.1 e.g. Xcode 10, Android Studio 3.2
  • React Native version:
    • 0.57.8
  • React Native Firebase library version:
    • 5.2.1"
  • Firebase module(s) you're using that has the issue:
    • [x] N/A
    • [ ] Authentication
    • [ ] Analytics
    • [ ] Cloud Firestore
    • [ ] Cloud Messaging (FCM)
    • [ ] Crashlytics
    • [ ] Dynamic Links
    • [ ] Functions Callable
    • [ ] In App Messaging
    • [ ] Indexing
    • [ ] Invites
    • [ ] Instance ID
    • [ ] ML Kit
    • [ ] Notifications
    • [ ] Performance Monitoring
    • [ ] Realtime Database
    • [ ] Remote Config
    • [ ] Storage
  • Are you using TypeScript?
    • [x] No
    • [ ] Yes, version: N/A
  • Are you using Expo, e.g. ExpoKit?
    • [x] No
    • [ ] Yes, I've not ejected
    • [ ] Yes, but I have ejected to ExpoKit
    • [ ] Yes, but I have ejected to vanilla React Native
    • Expo version: N/A

kyle-ssg avatar Mar 14 '19 15:03 kyle-ssg

I also have this problem =/

CyrusZei avatar Mar 17 '19 22:03 CyrusZei

TRy comment out your use_frameworks! inside of your podfile

CyrusZei avatar Mar 17 '19 22:03 CyrusZei

Did you add FirebaseCore/FirebaseCore.h to AppDelegate.m ? If not ,you have to add it or pod install again, if it does not work ,remove the app and install again.

denizbas92 avatar Mar 18 '19 11:03 denizbas92

Same here

hellpirat avatar Mar 18 '19 13:03 hellpirat

Fixed by this - issues/1764#issuecomment-452178852

system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")

hellpirat avatar Mar 18 '19 15:03 hellpirat

Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '19 09:04 stale[bot]

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.

stale[bot] avatar May 06 '19 14:05 stale[bot]

same issue

React Native - 0.59.8 Firebase - 6.2.0 xcode - 9.4.1 mac os - 10.13.2

nabeelItilite avatar Jun 26 '19 07:06 nabeelItilite

These have a few general patterns.

If you just integrated, and you already have a Podfile, you should unlink react-native-firebase, move your Podfile aside, then relink and then move your Podfile back in place, as react-native-firebase should not be integrated via Pods at this time (that will change in the future but is the v5 recommendation)

Then either way, you will probably need this workaround in your Podfile for the underlying Firebase SDK pods (which should be in the Podfile): https://github.com/mikehardy/rnfbdemo/blob/master/Podfile#L92

mikehardy avatar Jun 26 '19 15:06 mikehardy

same issue

React Native - 0.59.8 Firebase - 6.2.0 xcode - 9.4.1 mac os - 10.13.2

@nabeelItilite

my environment was very much like yours. And here was also returning Error. So after doing tests in many ways, this one here "rnfb-demo" was what solved.

As my project already existed, I needed to add Firebase to my environment. And Firebase is a huge library. My mission was to stabilize the versions of the components for the App to re-run. There have been many researches and new beginnings. It's been 5 days working.

To solve after many attempts I followed the @mikehardy tutorial that worked.

  1. I started by doing a backup of the project (basically I duplicated the entire project folder and named it "project-copy-name".

  2. delete the folders "ios", "android" and "node_modules"

  3. I cleaned the caches: killall 9 node && watchman watch-del-all && rm -rf $ TMPDIR / react- * && rm -rf $ TMPDIR / npm- * && rm -rf $ TMPDIR / haste- * && rm -rf $ TMPDIR / * && rm -rf ~ / Library / Developer / Xcode / DerivedData / Farmazon- *

  4. I used the yarn install command to import a new component folder" node_modules "

  5. I also used the npm install command, it sounds crazy, but until that happened to me.

  6. I used the react-native eject command to recreate the project folders (ios and android) so the projects came new from the factory, according to the versions that are in the package.json.

  7. I used the react-native link command to link the react libraries etc to native projects. (only this is not enough .. doing a build in this step will surely return red screen ... and still need to go back to the beginning and do the steps again.)

  8. Now is the time to apply some updates on each of the iOS and Android projects, as I mentioned above that the "link" is not enough.

[@mikehardy] has developed a script that starts a new project, RN versions 59 and 60 so just run the script that an entire project is created and connected to the firebase. It works! But as in my case I need to apply on my current project, so I did the steps that are in the script he built.

Here is the link to the script: [follow from line 20] https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

Here is the link to github: https://github.com/mikehardy/rnfbdemo

The versions of my packages:     "react": "^ 16.8.3",     "react-native": "^ 0.59.10",     "react-native-firebase": "5.3.1",     "react-native-awesome-card-io": "^ 0.8.2", ****     "react-native-vector-icons": "^ 6.3.0", ****

  • These are packages that require the react-native link command to compile.

ANDROID:       gradle: 5.4.1       buildToolsVersion = "28.0.3"       minSdkVersion = 16       compileSdkVersion = 28       targetSdkVersion = 28       supportLibVersion = "28.0.0"      "play-services-base: 16.1.0"       "firebase-core: 16.0.9"

iOS:   pod 'Firebase / Core', '~> 6.3.0'

  1. I compiled the projects and they worked.

  2. I reintroduced the icons, bundle-id, images, splash screen etc .. everything that was already in the project originally.

It sure is a great big mission.

Well now I'm going back there and finish the project, good luck to us.

robleds avatar Jul 14 '19 21:07 robleds

Try remove the Podfile.lock file and Pods folder. Run 'pod install'. This working for me

GabrielScalici avatar Jul 16 '19 19:07 GabrielScalici

These have a few general patterns.

If you just integrated, and you already have a Podfile, you should unlink react-native-firebase, move your Podfile aside, then relink and then move your Podfile back in place, as react-native-firebase should not be integrated via Pods at this time (that will change in the future but is the v5 recommendation)

Then either way, you will probably need this workaround in your Podfile for the underlying Firebase SDK pods (which should be in the Podfile): https://github.com/mikehardy/rnfbdemo/blob/master/Podfile#L92

Hello @mikehardy , seems like the link is dead.

co-de avatar Sep 30 '19 11:09 co-de

Yeah - this issue is super old @co-de :-), we've all moved on to RN60 or RN61 now, I forked off RN59 support in my demo and you can see the old version (with workaround I intended to link before) here: https://github.com/mikehardy/rnfbdemo/blob/master/PodfileRN59#L92

mikehardy avatar Sep 30 '19 14:09 mikehardy

(also note that if you do move to RN60+ this problem is no longer happening for anyone, so there will be no root cause analysis as to why it's needed)

mikehardy avatar Sep 30 '19 14:09 mikehardy

(also note that if you do move to RN60+ this problem is no longer happening for anyone, so there will be no root cause analysis as to why it's needed)

@mikehardy I am at react-native: 0.61.1 and still having this issue and can't find the reason. I am not very familiar with Pods and stuff and have been struggling with this for days. Any recommendations?

co-de avatar Oct 23 '19 07:10 co-de

@co-de if you're not very familiar with pods and have been struggling for days then I apologize - as this is drastic - but I'd throw away the project and rebuild one (like from rnfbdemo.sh script above - but customized to at least start with the correct name), then swap your javascript stuff back in on top of it once you have a base that you know works. It took me quite some days to upgrade my own project from the pre-pods style to the RN0.60 pods+auto-link style and in the end I might have been better off just throwing it out and swapping the javascript back in on top of it as well.

All I can say is that from a clean RN60 project (and in mine on RN0.61.2 now, with pods) this does not reproduce, so I don't know.

mikehardy avatar Oct 23 '19 14:10 mikehardy

Hi, i was facing this issue . But i have this fixed error now. Go to Pod file and add "pod 'Firebase/Core', :modular_header => true and "pod 'Firebase/Core', :modular_header => true Screenshot 2019-12-19 at 11 26 32 AM

TajinderSinghBai avatar Dec 19 '19 06:12 TajinderSinghBai

@mikehardy I really think your advise about starting a new project then adding dependencies then original projects JS should be an official RN way of upgrading to 0.60+ haha much much easier than trying to upgrade!

rezasazesh avatar Jan 20 '20 07:01 rezasazesh

@rezasazesh well - I'd really consider it a last resort, it's easy to forget all the little tweaks made in Xcode projects since the project files are so opaque - but yeah, when confronted with a couple days of no progress, no harm in quickly trying something drastic. Glad you're project is working now, welcome to auto-linking and cocoapods - so much easier! :-)

mikehardy avatar Jan 20 '20 14:01 mikehardy

TRy comment out your use_frameworks! inside of your podfile

thx god i just comment use_frameworks and pod install again and it work!

aphiratnimanussonkul avatar Feb 06 '20 07:02 aphiratnimanussonkul