Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UMModuleRegistryAdapter.h not found when running React Native app in iOS simulator

I have a simple React Native app that I've been testing on Android and now want to test on iOS. It's using React Navigation.

I ran npm run ios but I'm getting the following error:

info In file included from 

/Users/rbbit/reactnative/testproj1/ios/testproj1/main.m:10:

/Users/rbbit/reactnative/testproj1/ios/testproj1/AppDelegate.h:9:9: fatal error: 'UMReactNativeAdapter/UMModuleRegistryAdapter.h' file not found

#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

info 1 error generated.

I opened XCode but I'm basically getting the same message, nothing else that would help me debug this.

I do see that there is a package called react-native-adapter (https://github.com/expo/expo/tree/master/packages/%40unimodules/react-native-adapter), however I'm hesitant to just install this since I followed the instructions on how to include react-navigation and didn't mention that, assuming this is related.

Also, that page says If you are using react-native-unimodules, this package will already be installed and configured!, and react-native-unimodules already is in my dependencies.

Any pointers on how to solve this? Thank you!

like image 319
Sandy Avatar asked Jun 25 '19 00:06

Sandy


2 Answers

For latest RN versions (RN 0.60+) errors like this should be fixed with the auto-linking and just running a pod install.

For older versions you should try:

react-native link in the root folder of your project

Then in Xcode Product->Clean Build folder, restart JS server and attempt to rebuild.

If still not working double check the configs from here:

https://github.com/unimodules/react-native-unimodules

and the App.delegate from here: https://gist.github.com/brentvatne/1ece8c32a3c5c9d0ac3a470460c65603

Sources:

Pod install reminder was first suggested by Sandy in the below comment

like image 66
Florin Dobre Avatar answered Sep 17 '22 10:09

Florin Dobre


pod install didn't work for me until I added these lines to my pod file:

require_relative '../node_modules/react-native-unimodules/cocoapods.rb'

And

use_unimodules!(modules_paths: ['../node_modules'])

Then do a pod install.

Example: https://gist.github.com/sjchmiela/6c079f2173938a9a61a7c6f053c45000

like image 23
Allen Avatar answered Sep 19 '22 10:09

Allen