Xcode 12 老项目pod提示头文件找不到

From: https://blog.csdn.net/chokshen/article/details/108843444

因为Xcode12默认将Architectures设置为了$(ARCHS_STANDARD) ,而废除了之前的VALID_ARCHS,所以需要更新相应的配置。

首先第一步要做的就是,删除之前的VALID_ARCHS,选中TARGETS—Build Settings—VALID_ARCHS,选中VALID_ARCHS按Delete键删除。

注意:如果之前是在项目PROJECT设置的VALID_ARCHS,请选中项目PROJECT—Build Settings—VALID_ARCHS

然后选中PROJECT**—Build Settings—Excluded Architecture,设置debug模式下Any iOS Simulator SDK的值为arm64release模式下Any iOS SDK的值为armv7(因为iOS14 SDK不再支持armv7架构的手机,所以需要将armv7剔除)**。

最后一步,参照上面的流程,Pods工程也需要做同样的操作。选中Pods的**PROJECT—Build Settings—Excluded Architecture**,手动添加相应的配置:

但是手动配置的话,每次pod install后,配置将会被覆盖,所以推荐在podfile里面添加以下配置,这样每次pod install完成后,pod会为你自动添加相应的配置。

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    if config.name == "Debug" then config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    else if config.name == "Release" then
      config.build_settings["EXCLUDED_ARCHS[sdk=iphoneos*]"] = "armv7"
    end
  end

注意:在使用pod install后,有时候会造成主项目PROJECT下Excluded Architecture配置被覆盖,所以pod install后最好是检查一下主项目的PROJECT配置,以确保万无一失。

参考资料:https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios

Author

陈昭

Posted on

2021-02-20

Updated on

2021-12-27

Licensed under

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

Kommentare

You forgot to set the shortname for Disqus. Please set it in _config.yml.