我想为模拟器和真实设备构建我的 Xcode 项目(本地反应和快速)。
模拟器效果很好。今天我尝试为我的设备构建它,我在 Xcode 栏中选择了我的设备并添加了要发布的方案(我必须这样做,因为我使用的是 React Native,否则捆绑包未打包)
然后在构建过程中会发生错误(在本例中为依赖项 RNPurchases,但这完全是随机的。有时是 Expo-Keep-Awake 或 Facebook)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RCPurchases", referenced from:
objc-class-ref in RNPurchases.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
甚至切换回构建配置Debug
在我的计划中不再有任何影响。
我已经尝试过几件事:
- 清除 Xcode 构建
- 删除 Pod 文件夹
- 删除 Pod 缓存
- 删除 Xcode/DerivedData
- reboot
没有任何作用。
这个问题对我来说很新,在过去两个月内已经出现过两次。不知何故,我再次运行了模拟器的构建,但从未运行过设备。半年前我还没有出现过这样的问题...
My Setup
- Xcode 12.4
- MacBook Pro(大苏尔 11.2.3)
- 应用程序目标的构建设置:仅构建活动架构:调试是,发布否)
- Pod-Target 的构建设置:仅构建活动架构:调试是,发布否)
- Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb' # expo uni modules
use_frameworks!
install! 'cocoapods', :deterministic_uuids => false, :warn_for_unused_master_specs_repo => false
target 'TrainUrTeam' do
platform :ios, '12.0'
# ... pods xyz
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
end
post_install do |installer| # src: https://stackoverflow.com/a/64139830/6003494
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
end
经过两周的谷歌搜索,我终于找到了一个可行的解决方案Post https://stackoverflow.com/a/52911280/6003494将其添加到Podfile
:
use_frameworks! :linkage => :static
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)