【发布时间】:2018-11-14 14:22:37
【问题描述】:
【问题讨论】:
标签: react-native expo react-native-navigation
【问题讨论】:
标签: react-native expo react-native-navigation
进入 (Project Name) -> Build Settings -> Search Paths -> Header Search Paths 并添加文件所在的目录。如果您仍然遇到错误,请确保它也在 Build Phases 中设置-> 将二进制文件与库链接。 Xcode 只是还不知道去哪里寻找那个文件。
【讨论】:
TLDR:我将此添加到我的 Podfile。
pod 'React',
:path => "../node_modules/react-native",
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
pod 'yoga',
:path => "../node_modules/react-native/ReactCommon/yoga"
pod 'DoubleConversion',
:podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
:inhibit_warnings => true
pod 'Folly',
:podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
:inhibit_warnings => true
pod 'glog',
:podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
:inhibit_warnings => true
长答案:
去年大部分时间我都遇到了这个问题,我一直在努力寻找一个好的解决方案。不过我觉得这个可行。
问题是找不到该文件。
我首先尝试如下重定向路径:
#import <React/{wherever the folder that file was located in}/FILE.h>
我发现这是一个无限循环。改变的太多了。过了一会儿,我认为问题出在我的 Podfile 上。如果未找到导入,则说明导入或链接可能存在问题 - 因此是 Podfile。
在 RN Docs troubleshooting section 中提到
如果您使用的是 CocoaPods,请确认您已将 React 与子规范一起添加到 Podfile。
不确定要包括哪些,我在世博论坛上找到了一些帮助。
https://forums.expo.io/t/upgrading-to-sdk-26-pod-install-issue/8294
这个问题花了我一周的时间,所以我真的希望你们中的一些人能够使用它。感谢阅读!
【讨论】: