"Rctbundleurlprovider.H" File Not Found - Appdelegate.M

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 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.

file not found #import React/RCTBundleURLProvider.h

Do the following:
XCode Product ⇒ Scheme ⇒ Manage Schemes ⇒ Click '+'
At the Target Dropdown choose "React" and after saving this, scroll down and check the shared checkbox

Sample Image

format error when adding to AppDelegate.m

Definition of method should not be included in @interface ... end, Only properties and methods are declared in @interface ... end

You are trying to write the definition of method in,

@interface 
...
@end

Instead add the method in

@implementation 
...
@end

So after adding your code, it should look like below,

@implementation 

/* for rn code push */
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [CodePush bundleURL];
#endif
}

@end

React/RCTBundleURLProvider.h' file not found using custom xcode build configuration

I had a similar problem and after trying many alternatives I found the problem was with custom Build Configuration in Xcode (in my case were Alpha and Beta). When you compile, apparently Xcode try to use your Target Build Config on Frameworks too, and this causes the error.

Solution One (Manual)

Do it manually as beretis answern, but it is hard to mantain, because whenever you add a new Framework/Library you have to set the Build Configs in it or new errors will appear.

Solution Two (Automated)

Use react-native-schemes-manager (https://www.npmjs.com/package/react-native-schemes-manager).

This package synchronize your custom Build Configurations in all your Frameworks.

yarn add --dev react-native-schemes-manager

or

npm install --save-dev react-native-schemes-manager

In your package.json add the postinstall command, so every time you install new package/framework it will sync you Build Configurations.

"scripts": {
"postinstall": "react-native-schemes-manager all"
},

Still in package.json, add a new key with config.

   ...

"xcodeSchemes": {
"Debug": ["Alpha"],
"Release": ["Beta"]
},

...

In the example above all Frameworks will have 4 Build configurations:

Debug, Release , Alpha (copied from Debug), Beta (copied from Release).

after that, just run:

npm run postinstall

Hope it helps!



Related Topics



Leave a reply



Submit