【问题标题】:Error on terminal while adding pod - [!] Invalid Podfile file: The target Pods-MyApp already has a platform set添加 pod 时终端出错 - [!] Invalid Podfile file: The target Pods-MyApp has a platform set
【发布时间】:2016-10-21 10:49:54
【问题描述】:

在我的应用中,我使用 CocoaPod 集成了 Googlemap。

现在我想使用 CocoaPod 集成 CitrusPay 但是当我在终端上执行 pod install 命令时出现错误 - [!] Podfile 文件无效:

目标Pods-MyApp已经有一个平台集..

来自 /Users/NewFolder/Desktop/xyz.app.MyApp.ios/Podfile:10

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'

有谁知道如何解决这个错误?

【问题讨论】:

  • 只需使用“pod update”而不是“pod install”并检查它是否有效,让我知道
  • @Janmenjaya 我也尝试过 pod update 命令但得到同样的错误
  • 你可以显示你的终端截图你在做什么吗?
  • @balkaransingh 我收到错误 - Savitas-Mac-mini:ufony.app.schooldiary.ios Savita$ pod install [!] Invalid Podfile file: 目标 Pods-School Diary 已经有一个平台集.. # 来自 /Users/Savita/Desktop/Savita/CitrusIntegration/Using CocoaPod/ufony.app.schooldiary.ios/Podfile:10 # -------------------- ----------------------- # source 'github.com/CocoaPods/Specs.git' > platform :ios, '8.1' # pod 'GoogleMaps' # ------ ------------------------------------- Savitas-Mac-mini:ufony.app.schooldiary.ios萨维塔$
  • 尝试一种方法,从 pod 文件中删除 pod,然后再次添加。可能会有帮助。

标签: ios objective-c cocoapods


【解决方案1】:

我和你有同样的问题,比在互联网上搜索答案,但没有,所以我自己解决问题, 步: 第一:确定你的“Podfile”文件只有一次“平台:ios,'版本'”; 第二:在文件顶部添加“target 'yourtarget'do”; 第三:在文件底部添加“end”。

您必须保持您的“Podfile”文件具有格式化程序: enter image description here

你会解决这个问题,希望能帮助你。谢谢。

【讨论】:

  • 谢谢,但我已经解决了这个问题。我的问题是我已经声明了“平台:ios,'版本'”两(2)次。
【解决方案2】:

将目标添加到您的 podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'

target 'YourTarget' do
   pod 'GoogleMaps'
end

【讨论】:

    【解决方案3】:

    我遇到了同样的问题,最终我解决了,现在我的 Podfile 看起来像这样

    #Alamofire - lib for HTTP requests
    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '10.0'
    use_frameworks!
    
    target 'Fitzz' do
    pod 'Alamofire', '~> 4.0'
    
    #XCGLogger - lib for loggin output
    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '8.0'
    use_frameworks!
    
    pod 'XCGLogger', '~> 4.0.0'
    
    end
    

    我是 iOS 新手,但这对我有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-20
      • 2017-09-17
      • 2022-11-20
      • 1970-01-01
      • 1970-01-01
      • 2022-12-27
      • 1970-01-01
      相关资源
      最近更新 更多