添加pod时终端出错 - [!]无效的Podfile文件:目标Pods-MyApp已经有一个平台集

时间:2016-10-21 10:49:54

标签: ios objective-c cocoapods

在我的应用中,我使用 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'

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

3 个答案:

答案 0 :(得分:1)

将目标添加到您的podfile

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

target 'YourTarget' do
   pod 'GoogleMaps'
end

答案 1 :(得分:1)

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

你必须维护你的“Podfile”文件有格式化程序: enter image description here

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

答案 2 :(得分:0)

我有同样的问题,最终我解决了,现在我的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的新手,但这对我有用