微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ios – 为CocoaPods的pod设置部署目标

我使用 CocoaPods来管理项目中的依赖关系.我写了Podfile:
target 'MyApp' do
  platform :ios,'8.0'
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  #use_frameworks!

  # Pods for MyApp
  pod 'KeepLayout',:git => 'https://github.com/iMartinKiss/KeepLayout',:tag => 'v1.6.0'
  pod 'EasyMapping'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MyAppUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

文件与CocoaPods 0.x配合使用,但在我更新到CocoaPods 1.0之后,我无法编译项目.运行后

pod update

我无法编译我的项目错误

/Users/<…>/Pods/KeepLayout/Sources/KeepAttribute.m:195:1: Cannot synthesize weak property because the current deployment target does not support weak references

我看到每个库都是用不同的部署目标构建的.例如,KeepLayout由4.3部署目标构建.

我如何确定每个pod依赖关系的构建目标?

解决方法

虽然CocoaPods的一些开发版本(以及1.0版之前版本)可能会将项目的部署目标传播到pod,但这是 no longer the case in 1.0.为了解决这个问题,the current developer recommends使用后安装钩子.

这是一种强制性的方法来强制生成的Pods项目中每个pod的硬编码部署目标.将其粘贴到您的Podfile结尾:

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

原文地址:https://www.jb51.cc/iOS/329896.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐