【问题标题】:"pod update" doesn't update to latest version“pod update”不会更新到最新版本
【发布时间】:2016-02-26 21:24:35
【问题描述】:

这是我在项目中使用的 podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod 'AFNetworking', '~> 2.0'
pod 'GoogleMaps'
pod 'MONActivityIndicatorView'
pod 'NYXImagesKit'
pod 'MagicalRecord'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
pod 'Countly'

问题是 cocoapods 0.39 正在将 AFNetworking 更新到 2.5.4 版本,这是错误的。最新版本是 2.6.3 并且 facebook SDK 更新到 4.4(最新是 4.8)等等。

我尝试删除 Pods 文件夹和 .lock 文件,但没有帮助

还尝试清理 cocoapods 缓存但没有帮助:

MACMINI:myproject myusername$ pod cache clean --all
MACMINI:myproject myusername$ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (2.5.4)
Installing Bolts (1.2.0)
Installing Countly (15.06.01)
Installing FBSDKCoreKit (4.4.0)
Installing FBSDKLoginKit (4.4.0)
Installing FBSDKShareKit (4.4.0)
Installing GoogleMaps (1.10.1)
Installing MONActivityIndicatorView (0.0.3)
Installing MagicalRecord (2.3.0)
Installing NYXImagesKit (2.3)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `myproject.xcworkspace` for this project from now on.
Sending stats
Sending stats
Pod installation complete! There are 9 dependencies from the Podfile and 10 total pods installed.

【问题讨论】:

  • 您的可可豆荚是最新的吗?
  • 是的。如上所述,我将 cocoapods 更新到 0.39.0 版
  • 也许尝试从 AFNetworking 行中删除 , '~> 2.0'?并删除强制使用框架?
  • 确保podspec 版本信息正确,并且该版本指向正确的标签

标签: ios cocoapods afnetworking-2


【解决方案1】:

就我而言,Neon 不会为我更新。原来是因为部署目标。

改变了 platform :ios, '8.0'platform :ios, '10.0'

并且更新工作正常。

【讨论】:

  • 正确答案。我搜索了很多,尝试了几种方法,这家伙终于节省了我的时间。
  • 这是完美的解决方案!谢谢博雅各布
【解决方案2】:

CocoaPods 无法获取最新版本的 pod 的原因之一可能是另一个需要较早版本的依赖项。

例如,假设 PodA 的最新版本是 2.6,而您的 Podfile 中有这个:

pod 'PodA', '~> 2.0'
pod 'PodB'

你不知道,PodB 有以下依赖: “PodA”:“~> 2.5.4”

当 CocoaPods 试图满足依赖时,它会拒绝 PodA 2.6 版本,因为它无法满足对 PodB 更强的依赖约束。

解决此问题的一种方法是要求 CocoaPods 在运行“pod update”之前通过设置以下环境变量来打印内部依赖图调试信息

export MOLINILLO_DEBUG=1

【讨论】:

  • 如果有人卡在这里想弄清楚它是哪个部门,请尝试将其中一个 Pod 强制为其最新版本,例如 pod 'Firebase/Firestore', '> 8.6.0' 并运行 pod update。如果使用您的版本无法满足 dep 的要求,它应该告诉您 哪个 pod 导致了这种情况。就我而言,FirebaseFirestoreSwift 想要一个超级旧版本的 Firestore。我通过将其硬编码为最新的 beta pod 'FirebaseFirestoreSwift', '8.6.0-beta' 来修复它
【解决方案3】:

安装最新的 cocoapods 对我有用。

sudo gem install cocoapods

【讨论】:

    【解决方案4】:

    我尝试了一个新的 pod,它为我提供了最新的

    Update all pods
    Updating local specs repositories
    Analyzing dependencies
    Downloading dependencies
    Installing AFNetworking (2.6.3)
    Generating Pods project
    Integrating client project
    
    [!] Please close any current Xcode sessions and use `AfnetworkingPodFic.xcworkspace` for this project from now on.
    Sending stats
    Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
    

    尝试清除 Cocoapods 的缓存

    你可以从下面找到方法

    https://gist.github.com/mbinna/4202236

    希望对你有帮助:)

    【讨论】:

    • 没有帮助我。更新主题
    • @Sergio 我得到了最新的,看看我更新的答案
    • @Sergio 尝试删除上面链接中提到的文件
    【解决方案5】:

    $ pod 更新

    在终端输入这个命令,调用 update all pod to new version

    【讨论】:

    • 为什么这被否决了?我遇到了完全相同的问题,这正确更新了我的豆荚
    • 它不适合我
    【解决方案6】:

    清除以下路径中的 pod 缓存并重新安装 pod。

    ~/Library/Caches/CocoaPods/

    ~/.cocoapods/repos/ibm-cocoapods-specs

    【讨论】:

      【解决方案7】:

      删除并重新安装 cocoapods 解决了问题:

      MACMINI:myproject myusername$ sudo rm -fr ~/.cocoapods/repos/master
      Password:
      MACMINI:myproject myusername$ pod setup
      Setting up CocoaPods master repo
      Setup completed
      MACMINI:myproject myusername$ cd ~/myproject/
      MACMINI:myproject myusername$ pod update
      Update all pods
      Updating local specs repositories
      Analyzing dependencies
      Downloading dependencies
      Installing AFNetworking 2.6.3 (was 2.5.4)
      Installing Bolts 1.5.0 (was 1.2.0)
      Using Countly (15.06.01)
      Installing FBSDKCoreKit 4.8.0 (was 4.4.0)
      Installing FBSDKLoginKit 4.8.0 (was 4.4.0)
      Installing FBSDKShareKit 4.8.0 (was 4.4.0)
      Installing GoogleMaps 1.10.5 (was 1.10.1)
      Using MONActivityIndicatorView (0.0.3)
      Using MagicalRecord (2.3.0)
      Using NYXImagesKit (2.3)
      Generating Pods project
      Integrating client project
      Sending stats
      Sending stats
      Pod installation complete! There are 9 dependencies from the Podfile and 10 total pods installed.
      

      【讨论】:

      • 这个解决方案太过分了。问题可能是 Podfile 中的依赖项,必须首先升级。
      • 不适合我
      【解决方案8】:

      请像下面这样更新您的 CocoaPods:

      myComputer:desiredFolder Test$ pod update
      

      【讨论】:

        猜你喜欢
        • 2018-04-16
        • 2020-09-16
        • 1970-01-01
        • 2023-03-19
        • 2023-04-05
        • 2017-10-03
        • 1970-01-01
        • 2018-02-27
        • 1970-01-01
        相关资源
        最近更新 更多