Xcode compilation, warning handling method

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.

The reason for the warning : This warning occurred when compiling the three-party library managed by cocoapods. The supported version of the third-party library starts from 9.0, and the minimum adaptation system set by the Xcode project is 11.0, which does not match, so a warning is reported

Solution : You can set the support range of all third-party libraries to be consistent with the project; the specific operation is to copy the following code into the Podfile and execute 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

Finally, attach a simple and rude way to deal with code warnings

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

Guess you like

Origin blog.csdn.net/KLong27/article/details/129167209