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

今天准备把工程的一些警告给消除了,看到了头疼的警告
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, 然后重新编译你会发现所有这种警告都消除了。

猜你喜欢

转载自blog.csdn.net/sky_long_fly/article/details/89713186