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

Xcode Build error: 'React/RCTBridge.h' file not found

Open MelissaWeng opened this issue 7 years ago • 7 comments

react-native: 0.49.3 "react-native-fcm": "^11.3.1" ejected to ExpoKit

I followed the instruction to do the configurations for IOS, got this error: "'React/RCTBridge.h' file not found" at the line #import <React/RCTBridge.h> (in RCTEventEmitter.h file) when build in Xcode.

Any solutions for that?

MelissaWeng avatar Jan 31 '18 15:01 MelissaWeng

clear derived data? usually it happens when the build is reusing some old derived data

evollu avatar Jan 31 '18 16:01 evollu

I did delete the derived data and still get the same error, do i need to move the React pod to ios/Frameworks?

zeddz92 avatar Jan 31 '18 17:01 zeddz92

I use ios/Frameworks for both react and fcm library. check the manual linking

evollu avatar Jan 31 '18 19:01 evollu

This issue took me a lot of time. It seems to be a problem of Cocoapods(1.4.0) and React Native 0.5x.x. I solved it by removed React and all the package links in Podfile looks like: # pod 'react-native-fcm', :path => '../node_modules/react-native-fcm' # pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

Then manual link these removing packages.

Note: Remember to remove parralled build and prepend React to the build list in edit Build Target.

deno028 avatar Mar 05 '18 06:03 deno028

@Deno028 Can you elaborate exactly what you have to do to remove React and all package links in the Podfile and then manual linking the removed packaged, seems I've manually linked packages before but I'm confused where it's all suppose to go within the pod workspace project and how that plays nicely

CapitanRedBeard avatar Jun 05 '18 23:06 CapitanRedBeard

@CapitanRedBeard Please dont run react-native link. It may break your IOS project link.

1. Remove React in pod. This is my Podfile:

def pod_packages
  pod 'SwiftyJSON', '3.1.4'
  pod 'Charts', '3.0.3'
  pod 'Firebase/Messaging'
  pod 'RSKImageCropper', '1.6.1'
  pod 'QBImagePickerController', '3.4.0'
  pod 'Fabric'
  pod 'Crashlytics'
end

abstract_target 'All' do
  target 'MyXXXProject' do
     pod_packages
  **###### note these packages was gen after run react-native link. Please dont run it. If you run you should comment it out by hand.**
     # pod 'react-native-config', :path => '../node_modules/react-native-config'
     # pod 'react-native-fcm', :path => '../node_modules/react-native-fcm'
     # pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
     # pod 'react-native-camera', path: '../node_modules/react-native-camera'


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

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end

2. To manual link: you just drag and drop the package from node_module folder like the official guide.

  • https://facebook.github.io/react-native/docs/linking-libraries-ios.html

This is my IOS project structure. ios-proj

deno028 avatar Jun 08 '18 01:06 deno028

@Deno028 You are right, for me I generated iOS project by eject or init command, so I don't have to manual link react libs, but I also must remove React Section in podfile even the official doc ask you to add them in pod, if add them I will can't run my project.

I think only old native project need to add react section to podfile, if your project is generated by Rn runtime, it already include linked Rn libs. If you add rn section to podfile, it will be duplicated, I real hope FB could offer more details workflow with cocoapod and update the offical doc.

elanpang avatar Jan 08 '19 09:01 elanpang