在 Xcode 10 上运行本机应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50752540/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:40:23  来源:igfitidea点击:

Run react native app on Xcode 10

xcodereact-nativexcode10

提问by Sajad Beheshti

I get this error when i want to run my react native app hello world app on Xcode 10 (new beta version), can you help me? The error :

当我想在 Xcode 10(新测试版)上运行我的 React Native 应用程序 hello world 应用程序时出现此错误,你能帮我吗?错误 :

error: Build input file cannot be found: '/Users/nic/Documents/X-Project/xapp/node_modules/react-native/Libraries/WebSocket/libfishhook.a'

错误:找不到构建输入文件:'/Users/nic/Documents/X-Project/xapp/node_modules/react-native/Libraries/WebSocket/libfishhook.a'

Screen shot from my Xcode

来自我的 Xcode 的屏幕截图

回答by Daniel

Thishelped me:

帮助了我:

Remove and add again libfishhook.a from Xcode and the path issue will resolve.

从 Xcode 中删除并再次添加 libfishhook.a,路径问题将得到解决。

enter image description here

在此处输入图片说明

回答by Gomino

This issue is caught by the stricter xcode 10 new build system.

这个问题被更严格的xcode 10 新构建系统捕获。

A temporary fix while react-native really fix the issue is to switch back to using the old build system

一个临时修复,而 react-native 真正解决这个问题是切换回使用旧的构建系统

In Xcode, Select File-> Project/Workspace Setting. You will see a Build System option to select the Legacy Build Systemas shown below

Xcode 中,选择File-> Project/Workspace Setting。您将看到一个 Build System 选项来选择Legacy Build System,如下所示

Legacy Build System option

旧版构建系统选项

Clearyour project and "Derived Data" Buildand Runyour project

清除您的项目和“派生数据”构建运行您的项目

BONUS Point:If you are using a CI/CD pipeline you can also add the xcodebuild argument -UseNewBuildSystem='NO'to the cli or via fastlane xcargs: "-UseNewBuildSystem='NO'"

加分点:如果您使用 CI/CD 管道,您还可以将 xcodebuild 参数添加-UseNewBuildSystem='NO'到 cli 或通过 fastlanexcargs: "-UseNewBuildSystem='NO'"

回答by NiFi

Manually copypasting libfishhook.a into the correct folder, as suggested here, worked for me:

按照此处的建议将 libfishhook.a 手动复制粘贴到正确的文件夹中,这对我有用:

For a solution, I copied the file from my ios/build/Build/Products/Debug-iphonesimulator/libfishhook.a and pasted it into ../node_modules/react-native/Libraries/WebSocket/ and got the build. I hope it helps.

...

对于解决方案,我从我的 ios/build/Build/Products/Debug-iphonesimulator/libfishhook.a 复制了文件并将其粘贴到 ../node_modules/react-native/Libraries/WebSocket/ 并获得了构建。我希望它有帮助。

...

回答by Naren

Daniel's answer helped me to solve problem. Just note that if it's tvOS, then the same action of removing and adding should be done of RCTWebSocket-tvOS.a

丹尼尔的回答帮助我解决了问题。请注意,如果是tvOS,那么RCTWebSocket-tvOS.a的删除和添加操作应该相同