我有一个简单的 React Native 应用程序,我一直在 Android 上测试它,现在想在 iOS 上测试它。它使用 React 导航。
I ran npm run ios
但我收到以下错误:
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.
我打开了 XCode,但基本上收到了相同的消息,没有其他可以帮助我调试的信息。
我确实看到有一个名为react-native-adapter 的包(https://github.com/expo/expo/tree/master/packages/%40unimodules/react-native-adapter https://github.com/expo/expo/tree/master/packages/%40unimodules/react-native-adapter),但是我很犹豫是否要安装这个,因为我遵循了有关如何包含反应导航的说明,并且没有提及这一点,假设这是相关的。
另外,该页面说If you are using react-native-unimodules, this package will already be installed and configured!
, and react-native-unimodules
已经在我的依赖项中了。
有关如何解决这个问题的任何指示吗?谢谢你!
对于最新的 RN 版本(RN 0.60+),这样的错误应该通过自动链接来修复,只需运行pod install
.
对于旧版本,您应该尝试:
react-native link
在项目的根文件夹中
Then in Xcode Product->Clean Build
文件夹,重新启动 JS 服务器并尝试重建。
如果仍然无法正常工作,请仔细检查此处的配置:
https://github.com/unimodules/react-native-unimodules https://github.com/unimodules/react-native-unimodules
and the App.delegate
从这里:https://gist.github.com/brentvatne/1ece8c32a3c5c9d0ac3a470460c65603 https://gist.github.com/brentvatne/1ece8c32a3c5c9d0ac3a470460c65603
Sources:
Pod 安装提醒是 Sandy 在下面的评论中首先建议的
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)