对我来说,看到这个最近开始发生的问题是很新的。以前,我的应用程序通过运行此命令可以在 iOS 模拟器上正常工作react-native run-ios
。现在我已经做了很多研究并让我的应用程序通过 XCode 运行。但不知何故,当应用程序通过 XCode 运行时,metro 捆绑程序并未链接。
我尝试通过运行该应用程序react-native run-ios
每次我都会看到这个错误。在这里复制粘贴每个错误太大了,但以下是其中一些:
Undefined symbols for architecture x86_64:
"Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from:
generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libMixpanel-swift.a(AutomaticProperties.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld /Users/careerlabsdev/Library/Developer/Xcode/DerivedData/CareerLabs_Elev8-gxcfanteiuxazegkgwkjkrjxbdmw/Build/Products/Debug-iphonesimulator/CareerLabs.app/CareerLabs normal
(1 failure)
为了让它发挥作用,我做了很多事情。我在这里获得的唯一成功是while running the command react-native run-ios, it opens up the metro bundler server
。之后它会失败并给出 1000 行错误。我选择了有一些奶油部分的错误。从错误中挑选一些关键词:
- ld:未找到架构 x86_64 的符号
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- 没听懂这个词Ld,列在 BUILD FAILED 下
我所做的如下:
- 删除node_modules、Pod。从 XCode 清理构建。跑步
npm install
进而cd ios && pod install
然后运行命令react-native run-ios
- 删除 Pod、Podfile.lock。做过
pod install
然后在根中react-native run-ios
- 做这些:
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install
cd ..
react-native run-ios
- 重新启动系统,再次运行命令
react-native run-ios
- Added arm64 in the 排除架构来自 XCode。请注意,这使我能够
build and run
该应用程序成功地在 XCode 上。但它不会连接到 Metro 捆绑服务器。看起来它运行的是释放模式 only.
- 更新了我的包
react-native-gesture-handler
到最新的一个1.10.3,看看是否可以解决我的问题。但没有运气。
My Podfile看起来像这样:
platform :ios, '10.0'
use_flipper!({'Flipper' => '0.81.0'})
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
我现在没有选择,正在等待给出一些见解。看到从未产生问题的事情上出现错误确实令人沮丧。我正在使用 Apple M1 芯片 Macbook。
更新V1.0
- 我尝试过评论
use_flipper!()
, 来自/ios/Podfile
,然后重新做同样的事情,比如删除Pods
, Podfile.lock
。运行这个命令,pod update && pod install && cd.. && npm run ios
。遇到多个问题。我不知道 Apple M1 上的 XCode 和 React Native 存在什么问题。
更新V2.0
我发现开发人员在一些重要的地方也有同样的抱怨。XCode 在没有通知的情况下强制将我的版本更新到 12.5。现在,XCode 给 RN 较旧的项目带来了问题。以下是相同的支持链接:
- Flipper 不使用 XCode 12.5 构建 (GitHub)
- 我需要脚蹼吗? (红迪网)
希望能给像我一样困惑的开发者一些启发。请看一下,看起来像Facebook
正在修复,但不知道什么时候。必须留意它:/