React Native 0.40.0: Rctbundleurlprovider.H" File Not Found - Appdelegate.M

React Native 0.40.0 : RCTBundleURLProvider.h” file not found - AppDelegate.m

As of React Native 0.40 (see release notes), native code on iOS must refer to headers out of the react namespace. Previously the following would work:

#import "RCTBundleURLProvider.h"

But now all headers have been moved:

#import <React/RCTBundleURLProvider.h>

If you are updating an existing project, you need to either

  • run react-native upgrade and merge these changes manually,
  • use the new react-native-git-upgrade tool, or
  • manually change all header imports to the new format.

RCTBundleURLProvider.h file not found - AppDelegate.m

Delete node modules, then run npm install (or better yet yarn) and after everything has finished downloading, run react-native upgrade which should give you the option to replace old files with the template ones, by doing so you re-link your native dependencies in react-native which should fix your problem. Of course don't forget to clean your project in Xcode.

`React/RCTBridgeModule.h` file not found

In my case this particular problem happened when I was trying to archive a 0.40+ react-native app for iOS (solution was found here: Reliable build on ^0.39.2 fails when upgrading to ^0.40.0).

What happened was that Xcode was trying to build the react-native libraries in parallel and was building libraries with implicit react dependencies before actually building the react library.

The solution in my case was to:

  1. Disable the parallel builds:

    • Xcode menu -> Product -> Scheme -> Manage Shemes...
    • Double click on your application
    • Build tab -> uncheck Parallelize Build
  2. Add react as a project dependecy

    • Xcode Project Navigator -> drag React.xcodeproj from Libraries to root tree
    • Build Phases Tab -> Target Dependencies -> + -> add React

Using package-lock.json with version control

  • When you install the dependencies of libraries, you need to lock down the version of them. So You should get used to the package manager like npm, yarn, ...
  • I recommend use Yarn This is the document for how to using it. https://yarnpkg.com/en/docs
  • ie: install lib react-native-button. you just need run command yarn add react-native-button and commit the yarn.lock with package.json files. Then the guys in your team can pull these changes and run 'yarn install' to keep the synchronize for you projects.
  • Check it out and try. it is simple!


Related Topics



Leave a reply



Submit