JainZz
JainZz

Reputation: 612

Lexical or preprocessor issue in Xcode 8.0

I'am using react native: 0.41.2, react: 15.4.2 and cocoapods for firebase(https://github.com/evollu/react-native-fcm). I have an issue while building the code. 'React/RCTEventEmitter.h', 'React/RCTBridgeModule.h', 'React/RCTViewManager.h', 'React/RCTDefines.h' these files are not found error is throwing while running the project.

But these files are already in my project by clicking ctrl with that file name. Image

podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'

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

  # Pods for Inspector
  react_native_path = "../node_modules/react-native"
  pod "React", :path => react_native_path, :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  target 'Inspector-tvOSTests' do
    inherit! :search_paths
    pod 'Firebase/Messaging'
    # Pods for testing
  end

  target 'InspectorTests' do
    inherit! :search_paths
    pod 'Firebase/Messaging'
    # Pods for testing
  end

end

Upvotes: 2

Views: 4266

Answers (1)

Hariks
Hariks

Reputation: 1889

For those who facing this issue, it is due to header import issues with react native 0.41.2 along with cocoapods To resolve these errors follow these steps

1npm install -g react-native-git-upgrade

2 go to your project root folder and do

react-native-git-upgrade

3 Solve conflicts if any occur while upgrading RN

4 Now remove React dependencies from pod file else you will have two React in schemes(One RN and One Pod) and it will cause no input error while building. Your pod file should look like this

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'

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

  # Pods for Inspector   // Pods for your app, in this case firebase is used
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  target 'Inspector-tvOSTests' do
    inherit! :search_paths
    pod 'Firebase/Messaging'
    # Pods for testing
  end

  target 'InspectorTests' do
    inherit! :search_paths
    pod 'Firebase/Messaging'
    # Pods for testing
  end

end

5 cd ios && pod install

6 Close Xcode and open .xcworkspace file

Upvotes: 1

Related Questions