升级到Xcode 12:ld之后的问题:为iOS Simulator构建,但在为iOS构建的dylib中链接,体系结构arm64

时间:2020-09-21 13:16:31

标签: xcode12

我将Xcode升级到Xcode 12,并构建了我的项目。 首先,出现如下错误:

ld:为iOS Simulator构建,但在为iOS构建的dylib中链接,文件'/Users/ethanli/Documents/Aspira/RA.com4iOS/RA.com4iOS/source/ReserveAmerica/ReserveAmerica4/External/Mapbox/MapboxMobileEvents.framework / mapboxMobileEvents'用于架构arm64

我通过在“构建设置”中的“排除的体系结构”中添加“ arm64”来消除此错误。参考 https://developer.apple.com/forums/thread/656509

configuration like this

但是...又出现了另一个错误:

错误:找不到构建输入文件:'/Users/ethanli/Library/Developer/Xcode/DerivedData/ReserveAmerica4-cgnruuknmgycgrbadguodtkwspmy/Build/Products/DEBUG-iphonesimulator/ReserveAmerica4.app/ReserveAmerica4'(在目标'ReserveA中'来自项目“ ReserveAmerica4”)

我转到Finder中的路径,“ ReserveAmerica4”确实不存在。

有什么办法解决这个问题?

4 个答案:

答案 0 :(得分:8)

我解决了此错误。

根本原因是Xcode 12不允许为Simulator构建arm64体系结构。我们应该为模拟器构建设置x86_64。

  1. 在目标“构建设置”标签中将“仅构建活动体系结构”设置为“是”;
  2. 为模拟器设置x86_64: enter image description here

更多答案:Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

答案 1 :(得分:1)

在做了很多事情比如安装 pods 之后,我再次克隆了这个项目,删除了之前的一个,它对我有用。

答案 2 :(得分:0)

  1. 评论有关 Firebase 的 pod 文件(您可能还需要评论您的程序代码),pod 文件示例:

enter image description here

  1. 退出 Xcode
  2. pod 安装
  3. 重启Xcode并构建项目
  4. 取消注释有关 Firebase 的 pod 文件
  5. 退出 Xcode
  6. 再次安装pod
  7. 重启Xcode并构建项目

答案 3 :(得分:0)

你可以用这个来修复它

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end