【问题标题】:How to solve this error like Invalid `Podfile` file: [!] Unsupported options `{:exclusive=>true}` for target如何解决此错误,例如 Invalid `Podfile` 文件:[!] Unsupported options `{:exclusive=>true}` for target
【发布时间】:2017-02-20 11:59:57
【问题描述】:

我从存储库克隆项目,并且这个项目 podfile 包含版本 0.39.0。当我尝试 pod install 命令时,我总是收到类似的错误 Podfile 文件:[!] 不支持的选项 {:exclusive=>true} for target’。 Podfile 如下所示

inhibit_all_warnings!

def shared_pods

    pod 'AFNetworking', '~> 2.0'
    pod 'Crashlytics'

end

target ‘product_DEV' do
    shared_pods
end

target ‘productTests', :exclusive => true do

    shared_pods

end

如何解决这个问题?请帮帮我。

【问题讨论】:

  • 请出示您的 podfile,以便我们了解清楚。

标签: ios iphone xcode cocoapods podfile


【解决方案1】:
  • :exclusive => true do 已被弃用,请查看this 迁移指南。

    • 尝试重新初始化 pod 文件,这样您就可以获得最新的 pod 文件。
    • 或者尝试把 pod 文件内容改成这样,

      # Uncomment the next line to define a global platform for your project
      # platform :ios, '9.0'
      
      target 'product_DEV' do
      
      use_frameworks!
      
      pod 'AFNetworking', '~> 2.0'
      pod 'Crashlytics'
      
      target 'productTests' do
      inherit! :search_paths
      end
      
      end
      
    • 这是一个绑定镜头,试一试可能会有帮助,查看其他参考ref1,ref2

    • 检查 ref2 abstract_target 可能会有所帮助。

      abstract_target 'DummyTarget' 做 豆荚“……” 目标“App1”做 结尾 目标“App2”做 结尾 结束

【讨论】:

  • 但我的 pod 版本显示为 0.39.0。我可以在不删除 ':exclusive => true 的情况下解决问题吗?
  • 如果克隆的 repo 是公开的,你可以分享克隆 url,检查this,如果你使用 xcode 8 那么它适用于 CocoaPods 1.1.0 仅限。
  • 我想使用 xcode7.2。我无法共享克隆 url。它是私有的
  • 我曾尝试降级我的 cocopods 版本以支持podfile(versio 0.39.0),但最终出现错误ERROR: Could not find a valid gem '0.39.0' (>= 0) in any repository。我认为我们不能使用旧版本。最好尝试降级您的 cocopods 版本。这是我用来降级的sudo gem install cocoapods ver 0.39.0 -n /usr/local/bin cocoapods
猜你喜欢
  • 1970-01-01
  • 2021-09-12
  • 1970-01-01
  • 2022-10-02
  • 1970-01-01
  • 2020-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多