【问题标题】:Error installing Google-API-Client using cocoapods in iOS在 iOS 中使用 cocoapods 安装 Google-API-Client 时出错
【发布时间】:2016-09-29 02:08:45
【问题描述】:

我在为我的 iOS 应用程序安装 Google-API-Client 时遇到问题,我在终端中收到以下错误。

[!] 安装 Google-API-Client 时出错 [!] /usr/bin/svn export --non-interactive --trust-server-cert --force //google-api-objectivec-client.googlecode.com/svn/trunk/ -r 393 /var/folders/3w/401dr8w510vdwk_8x5d_yx1m0000gn/T/d20160531-21031-1o5mmpa

svn: E160013: 无法连接到 URL 上的存储库 'http://google-api-objectivec-client.googlecode.com/svn/trunk' svn: E160013: '//google-api-objectivec-client.googlecode.com/svn/trunk' 找不到路径

我的 podfile 内容是:

# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'

target 'MyProject' do

pod 'Google-API-Client'

end

【问题讨论】:

  • 我不知道这是否能解决你的问题,但你应该在你的 pod 文件的顶部有一个源 --> source 'https://github.com/CocoaPods/Specs.git'
  • 我在我的 pod 文件顶部添加了该行,但仍然出现同样的错误。
  • 尝试将您的平台更新为“8.0”而不是“6.0”
  • @UmairAfzal 在我的 podfile 中将平台从“6.0”更新为“8.0”后,我仍然面临同样的错误。

标签: ios git cocoapods


【解决方案1】:

我终于找到了无法使用 cocoapods 安装 Google-API-Client 的解决方案。问题是我正在使用 Google-API-Client 的 cocoapods 文档中提到的“Google-API-Client”,但它不推荐使用命名约定,或者它们的 podspec 发生了变化。所以我无法得到那个吊舱。

因此,具有正确 Google-API-Client 的最终 podfile 如下所示

# Uncomment this line to define a global platform for your project # platform :ios, '6.0' target 'MyProject' do pod 'GoogleAPIClient' end

【讨论】:

    【解决方案2】:

    打开终端并通过键入将目录更改为您的项目文件夹

    cd ~/"path"
    
    • 将路径替换为项目的文件夹路径
    • 然后输入pod init
    • 转到您的项目文件夹并打开新创建的 Podfile

    你的 Podfile 应该是这样的

    platform :ios, '9.0'
    use_frameworks!
    target 'YourProjectName' do
    
    pod 'Google-API-Client'
    
    end
    

    保存 Podfile 并返回终端并输入

    pod install
    

    【讨论】:

    • 嗨 Umair,我已经在单独的新项目中尝试过这个,也面临同样的错误。你的机器上也面临同样的问题吗?
    • 我在 podfile 中写过 : pod 'Google-API-Client', :git => 'github.com/google/google-api-objectivec-client' 我收到以下错误:[!] Unable to find a specification for 'Google- API-客户端'。 [!] 无法从 GoogleAPIClient.podspec 加载 podspec,跳过:Pod::DSLError
    【解决方案3】:

    最好使用您要使用的 api 客户端。例如,如果您想要 api 客户端休息。 吊舱“GoogleAPIClientForREST/日历”,“~> 1.2.1”。您可以直接使用范围和查询服务。

    Also most important thing is : 
    1. Quit Xcode. 
    2. Open terminal and change directory to folder containing the xcode file.
    3. Pod install. 
    4. Open the xcworkspace and wait a moment and BUILD it first with no errors. 
    5. Then import the file. Now it will work perfectly.
    

    【讨论】:

      猜你喜欢
      • 2023-03-20
      • 2020-06-14
      • 2013-11-13
      • 2017-09-04
      • 2016-01-07
      • 2014-06-20
      • 2020-12-09
      相关资源
      最近更新 更多