ios 警告:The iOS deployment target is set to x.x, but the range of supported deployment....消除

本文解决了一个常见的iOS项目警告问题:部署目标设置过低。通过调整Podfile中的代码,确保所有targets的部署目标不低于8.0,从而消除警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天准备把工程的一些警告给消除了,看到了头疼的警告
The iOS deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.2.99. (in target ‘AFNetworking’)在这里插入图片描述
他们是如何产生的呢?仔细看一下应该能理解其就是依赖的第三方库 在 pod 工程中 targets 中在这里插入图片描述
给出的警告。比如我自己的xcode 是 xcode 10.2 可以从警告看出,版本支持为8.0~12.2.99,当低于此范围则会给出警告。

消除警告

在podfile 最下方加上以下代码

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
      end
    end
  end
end

然后 pod install, 然后重新编译你会发现所有这种警告都消除了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值