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.66k stars 2.21k forks source link

🔥chrono file not found, firestore , gRPC-C++ #1984

Closed CyrusZei closed 5 years ago

CyrusZei commented 5 years ago

Issue

I have looked at the two other issues that have been posted here but with no luck and that is why I am posting this issue.

as soon as I add pod 'Firebase/Firestore', '~> 5.15.0' to my PodFile I get the "chrono file not found" I did read that is has with Time.h. I am using firestore in my app and I need that.

It has to do with the gRPC-C++ that is beeing added. Have been trying to figure this out for 3 days now with no luck.

If I remove the firestore from my podfile it builds and everything works just fine. Is there a version that I can downgrade to where firestore is not depending on the gRPC-C++ time.h thing ?


Project Files

iOS

ios/Podfile:

Screenshot 2019-03-17 at 23 35 29
# N/A

AppDelegate.m:

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"
#import <Firebase.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  [RNFirebaseNotifications configure];

  // Setup Notifications
  if ([UNUserNotificationCenter class] != nil) {
    // iOS 10 or later
    // For iOS 10 display notification (sent via APNS)
    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
    UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert |
    UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
    [FIRMessaging messaging].delegate = self;
    [[UNUserNotificationCenter currentNotificationCenter]
     requestAuthorizationWithOptions:authOptions
     completionHandler:^(BOOL granted, NSError * _Nullable error) {
       if (error) { NSLog(@"%@", error); }
     }];
  } else {
    // iOS 10 notifications aren't available; fall back to iOS 8-9 notifications.
    UIUserNotificationType allNotificationTypes =
    (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
    UIUserNotificationSettings *settings =
    [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
    [application registerUserNotificationSettings:settings];
  }
  [application registerForRemoteNotifications];

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

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"RoastLive"
                                               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

Android

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment


-----EXTRA INFO

the build error I get

Screenshot 2019-03-18 at 19 59 38

Framework search paths

Screenshot 2019-03-18 at 20 01 20

Header search paths

Screenshot 2019-03-18 at 20 01 57

Library search paths

Screenshot 2019-03-18 at 20 02 26

Link binary with libraries

Screenshot 2019-03-18 at 20 02 55

Think react-native-firebase is great? Please consider supporting the project with any of the below:

CyrusZei commented 5 years ago

for anybody that come here

try this fix

https://github.com/firebase/firebase-ios-sdk/issues/1916#issuecomment-474153045

it worked for me

scanifydevo commented 5 years ago

@CyrusZei I have faced the same issue. which header search path did you remove?

CyrusZei commented 5 years ago

I made a PR to the repo so if anybody else is stuck follow the guide I made

https://github.com/syanbo/react-native-agora/blob/master/docs/v2/ios.md

stale[bot] commented 5 years ago

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.

otusweb commented 5 years ago

i'm running into this issue too, though i don't have the search path issue. So I can't remove the recursive search path in the pod directory. I had to use the old build engine on one machine. Switching back to the new build engine did not repro the issue...

mikehardy commented 5 years ago

The original poster resolved the issue, so this should not receive further unrelated posts, please open a new issue following the template if there are more problems

eggybot commented 5 years ago

Still got this issue, detail of the problem explained here

Take note I already tried the suggestion solution from @wilhuff via @CyrusZei

riordanpawley commented 5 years ago

@eggybot Any luck on your end? I've been struggling with this issue too.

eggybot commented 5 years ago

@riordanpawley no luck and still getting this issue.

riordanpawley commented 5 years ago

@eggybot I've got my app building at the moment but I tried to reclone from the successful build's commit and run but the process to get it working was almost as convoluted as the first time lol. So yeah, I'll try and explain how I got it working but I couldn't figure it out on the second run through either. In the end these dependencies build and run but i seem to have to comment out different sections of the podfile and pod install and delete node_modules and reinstall in some kind of order and I also have to add that react-native.config.js file to my node_modules/react-native-firebase. I think react-native run-ios is what I used both times for the first successful build but I don't know if that's important. Feel free to ask if you have questions but I probably won't know the answers haha

TLDR: Working but not certain why. I think the important parts are make sure you use react-native-firebase 5.4.3 and add the react-native.config.js file to your react-native-firebase node modules folder.

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'dogg' do
  # Pods for dogg
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  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-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  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 '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 'Stripe', '~> 14.0.0'

  # Pods for dogg
  pod 'Firebase/Auth', '~> 6.3.0'
  pod 'Firebase/Core', '~> 6.3.0'
  pod 'Firebase/Firestore', '~> 6.3.0'
  pod 'Firebase/Database', '~> 6.3.0'
  pod 'Firebase/Functions', '~> 6.3.0'
  pod 'Firebase/Messaging', '~> 6.3.0'

#  post_install do |installer|
#    # react-native-firebase need some adjustements  with use_frameworks!
#    rnfirebase = installer.pods_project.targets.find { |target| target.name == 'RNFirebase' }
#    rnfirebase.build_configurations.each do |config|
#      # react-native-firebase HEADER_SEARCH_PATHS are not good
#      # This is to avoid the error
#      # 'Firebase.h' file not found with <angled> include; use "quotes" instead
#      config.build_settings['HEADER_SEARCH_PATHS'] = '$(inherited) ${PODS_ROOT}/Headers/Public/**'
#      # injecting `s.static_framework = true`
#      # (should be in RNFirebase.podspec but since it's not, the code below is doing the same behavior)
#      config.build_settings['MACH_O_TYPE'] = 'staticlib'
#    end
#  end

  pre_install do |installer|
    # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
    # to avoid
    # [!] The 'Pods-ADM' target has transitive dependencies that include statically linked binaries: (FirebaseCore, FirebaseInstanceID, FirebaseDynamicLinks, and FirebaseMessaging)
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  end

  use_native_modules!
end
"dependencies": {
    "@ptomasroos/react-native-multi-slider": "^1.0.0",
    "@react-native-community/slider": "^2.0.0-rc.1",
    "formik": "^1.5.7",
    "lodash": "^4.17.11",
    "moment": "^2.24.0",
    "prop-types": "^15.7.2",
    "react": "16.8.6",
    "react-instantsearch-native": "^5.7.0",
    "react-native": "0.60.0",
    "react-native-firebase": "5.4.3", // IMPORTANT
    "react-native-formik": "^1.7.6",
    "react-native-gifted-chat": "^0.9.6",
    "react-native-google-places": "^3.1.1",
    "react-native-google-signin": "^2.0.0",
    "react-native-maps": "https://github.com/react-native-community/react-native-maps.git", // necessary for a fix that isn't in the release yet
    "react-native-modal-datetime-picker": "^7.5.0",
    "react-native-paper": "^2.16.0",
    "react-native-prompt-android": "^0.3.5",
    "react-native-router-flux": "^4.0.6",
    "react-native-vector-icons": "^6.5.0",
    "react-redux": "^7.1.0",
    "react-redux-firebase": "^3.0.0-alpha.12",
    "recompose": "^0.30.0",
    "redux": "^4.0.1",
    "redux-firestore": "^0.8.0",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "tipsi-stripe": "^7.5.0",
    "yup": "^0.27.0"
  },

react-native.config.js

const path = require('path');

module.exports = {
  dependency: {
    platforms: {
      ios: { podspecPath: path.join(__dirname, 'ios', 'RNFirebase.podspec') },
      android: {
        packageImportPath: 'import io.invertase.firebase.RNFirebasePackage;',
        packageInstance: 'new RNFirebasePackage()',
      },
    },
  },
};