cocopods统一对Pods版本进行约束

2024-03-20  本文已影响0人  song91425

在PodFile文件的最后以后,添加下述命令:

1 对iOS版本进行约束,所以依赖的Pods最低版本为11

post_install do |installer|

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
    end
  end
end

2 对MacOS版本进行约束,所以依赖的Pods最低版本为10.13

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.platform_name == :osx
        config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.13'
      end
    end
  end
end

最后执行 pod install 就可以了

上一篇 下一篇

猜你喜欢

热点阅读