evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 681 forks source link

Redefinition of module 'Firebase' #1132

Closed Copser closed 4 years ago

Copser commented 4 years ago

Hello, I upgraded the project from following rn-diff-purge from 0.59.10 to 0.60.0, and I'm having problems when building a project. It smells like Firebase was integrated twice but I'm not been able to locate it, but that just me guessing, so can someone help please, thanks.

Screen Shot 2020-02-04 at 1 50 55 PM

and

Screen Shot 2020-02-04 at 2 11 14 PM

In Headers Search Paths

Screen Shot 2020-02-04 at 2 13 16 PM

1. What version of RN and react-native-fcm are you running?

System: OS: macOS Mojave 10.14.6 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 350.78 MB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node Yarn: 1.21.1 - ~/.yarn/bin/yarn npm: 6.13.0 - ~/.nvm/versions/node/v10.16.0/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: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: 0.60.0 => 0.60.0 npmGlobalPackages: react-native-cli: 2.0.1

"react-native-firebase": "~5.6.0",

2. What device are you using? (e.g iOS9 emulator, Android 6 device)?

I'm using emulator IOS11

3. Is your app running in foreground, background or not running?

My app is not running.

Pods

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

target 'Workbase' do
  # Pods for RnDiffApp
  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 'react-native-config', :path => '../node_modules/react-native-config'

  target 'WorkbaseTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'Workbase-tvOS' do
  # Pods for RnDiffApp-tvOS

  target 'Workbase-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

post_install do |installer|
  installer.pods_project.targets.each do |target|

    # The following is needed to ensure the "archive" step works in XCode.
    # It removes React & Yoga from the Pods project, as it is already included in the main project.
    # Without this, you'd see errors when you archive like:
    # "Multiple commands produce ... libReact.a"
    # "Multiple commands produce ... libyoga.a"

    targets_to_ignore = %w(React yoga)

    if targets_to_ignore.include? target.name
      target.remove_from_project
    end

    if target.name == 'react-native-config'
      phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
      phase.shell_script = "cd ../../"\
                           " && RNC_ROOT=./node_modules/react-native-config/"\
                           " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                           " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
                           " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"

      target.build_phases << phase
      target.build_phases.move(phase,0)
    end

    rnfirebase = installer.pods_project.targets.find { |target| target.name == 'RNFirebase' }
    rnfirebase.build_configurations.each do |config|
      config.build_settings['HEADER_SEARCH_PATHS'] = '$(inherited) ${PODS_ROOT}/Headers/Public/**'
    end
  end
end
Copser commented 4 years ago

For the time I spend writing this question I've ended up solving this by removing $(SCROOT)/Firebase from my Headers Search Path. I hade duplicated Firebase in the Xcode, confusion for me was that I somehow overlooked use_native_modules! in my Pods file and that is pulling firebase from node_modules.

temitope commented 4 years ago

@Copser thanks for documenting. Does this mean this library still works with RN 0.60 ?

Copser commented 4 years ago

Hey @temitope, it was working for me, but I had some other issues with my project, so I needed to degrade the project back to 59.10, so I'm not 100% sure that it will work on 0.60.