Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution: CocaPods + Podfile + use_frameworks! + Hybrid App + <React/RCTComponent.h> file not found #2324

Closed
olegserov opened this issue Jun 13, 2018 · 11 comments
Labels

Comments

@olegserov
Copy link

This is not a bug report, because the same bug was reported a dozen times and no one seems to have a fix. If maintainers wish incorporate this ticket into the doc - would be nice.

Steps to reproduce:

  1. You follow current install instructions.
  2. You use use_frameworks
  3. You try to compile and it fail endlessly on:
    #import <React/RCTComponent.h> file not found
    #import <React/RCTView.h> file not found
    #import <React/RCTViewManager.h> file not found
    Entry, ":CFBundleIdentifier", Does Not Exist

The root cause of the issue:

  1. You have to use use_frameworks
  2. This screws up somehow include paths and even if you fix it manually, down the line includes do not work.
  3. You added this to your Podfile
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
    if target.name == "React"
      target.remove_from_project
    end
  end
end
  1. That change excludes react from compiling and providing proper include location.
  2. If you don't do that change - react fails to be build by some other unknown reason.
  3. The solution
    • Undo all the attempts you made before.
    • Install react-native-maps thru pods with no custom hacks.
    • Fix React > Make React compile as a framework > Make react-native-maps compile > Profit

How to fix it:

  1. Remove all the manual links to react-native-maps
  2. Do a backup first.
  3. Do not follow documentation about changing Podfile.
  4. I am not sure that you must not run react-link.
  5. Delete these files:
    rm -rfv node_modules ios/Pods ios/Podfile.lock ios/build yarn.lock
  6. Updated pakage.json to:
"dependencies": {
    "husky": "^0.14.3",
    "react": "^16.4.0",
    "react-native": "^0.55.4",
    "react-native-maps": "^0.21.0",
    "react-native-vector-icons": "^4.6.0",
    "react-navigation": "^2.3.1",
    "prop-types": "^15.6.1"
  }
  1. Update Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
#plugin 'cocoapods-fix-react-native'
target 'ReactNativeSandbox' do
    use_frameworks!

    pod 'React', :path => '../node_modules/react-native', :subspecs => [
        'Core',
        'CxxBridge',
        'DevSupport',
        'RCTActionSheet',
        'RCTGeolocation',
        'RCTText',
        'RCTNetwork',
        'RCTWebSocket',
        'RCTNetwork',
        'RCTVibration',
        'RCTSettings',
        'RCTAnimation',
        'RCTLinkingIOS',
        'RCTImage',
    ]

    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 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
    pod 'react-native-maps', path: '../node_modules/react-native-maps'
end
  1. Install https://github.com/orta/cocoapods-fix-react-native but keep it commented in Podfile
  2. Run yarn install in the root project (were is your package.json is)
  3. Run pod install in the ios directory (where Podfile is)
  4. Uncomment plugin 'cocoapods-fix-react-native' in the Podfile and run pod install again.
  5. Now you can build ios project.
@olegserov olegserov changed the title CocaPods + Podfile + use_frameworks! + Hybrid App + <React/RCTComponent.h> file not found Solution: CocaPods + Podfile + use_frameworks! + Hybrid App + <React/RCTComponent.h> file not found Jun 13, 2018
@thanhdevapp
Copy link

Can someone give me sample code or proof when following this tutorial, I take too long to install for ios but it still does not work

@ttruongatl
Copy link

It works!

@emilefleming
Copy link

I followed the tutorial but am getting a build error in RCTWebSocket, 'React/fishhook.h' file not found. Did you encounter that at all along the way?

@olegserov
Copy link
Author

@emilefleming no, I have not seen that error unfortunately...

@whalemare
Copy link

whalemare commented Apr 1, 2019

Not works for "react-native": "0.59.1" by

[!] CP-Fix-React-Native does not support 0.59.1 yet, please send PRs to https://github.com/orta/cocoapods-fix-react-native

@rares-lupascu
Copy link

confirm not working on "react-native": "0.59.8"

@devanshAppiness
Copy link

confirm not working on "react-native": "0.59.8"

React/RCTViewManager.h' file not found
Even i am facing this for iOS. Any solution?

@sinclas
Copy link

sinclas commented Jul 11, 2019

I have this issue now after upgrading to RN 0.60.0 . I ran the pod installation exactly from the have. I have a production release that is now getting pushed back. I have no idea other than to revert back from my git repository and start all over? Anybody? Should I just us IOS maps and skip google maps in ios?

@erhanbicer
Copy link

not working "react-native": "0.61.5"

@shaikhaffan
Copy link

@erhanbicer did it work! if then how u did ? i tried so many ways but nothing works

@stale
Copy link

stale bot commented Oct 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 2, 2020
@stale stale bot closed this as completed Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants