【发布时间】:2021-04-26 23:22:43
【问题描述】:
我在为 iOS 构建我的 RN 应用程序时遇到了问题。为了消除我自己的代码问题,我创建了一个新项目,但我遇到了同样的错误。我做了以下事情(我使用的是带有 M1 芯片的 Macbook Pro):
- 使用
npx react-native init TestProject添加了全新安装 - 成功完成
pod update - 在 xcode 的项目根目录中添加了一个 .swift 文件来创建桥接头
- 清理了构建文件夹
- 试过
npx react-native run-ios但失败了,所以我尝试从xcode运行,它也失败了
问题似乎与链接有关,以下是我收到的一些警告:
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
然后在底部有一个错误说clang: error: linker command failed with exit code 1,列出了大约 23 个错误,都说Undefined symbol,然后是一堆 Swift 方法。
最初我认为这是我如何配置我的应用程序的问题,但由于全新安装也会发生同样的问题,我真的不知道从哪里开始。
我到处搜索并尝试了各种方法,例如旧版构建模式、更改各种构建设置,但都没有奏效。任何帮助将不胜感激。
我正在使用以下内容:
- xcode 12.4
- nodejs v16.0
- npm v7.10.0
- 反应 v17.0.1
- react-native v0.64.0
【问题讨论】:
标签: ios xcode react-native