Xcode编译,警告处理办法

1.

The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99.

警告的原因:在编译cocoapods管理的三方库时出现了这个警告,第三方库的支持的版本是从9.0开始,Xcode项目设置的适配最低系统为11.0,不匹配,所以报警告

解决办法: 可以把所有的第三方库的支持范围该为和项目一致;具体的操作就是把下面的代码复制到Podfile文件中,执行 pod install,即可.

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 < 9.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end
  end
end

最后附上一个简单粗暴的处理代码警告的办法

#pragma clang diagnostic push
#pragma clang diagnostic ignored"-Wdeprecated-declarations"
//这里是出现警告的代码片段或者方法
#pragma clang diagnostic pop

猜你喜欢

转载自blog.csdn.net/KLong27/article/details/129167209
今日推荐