解决pod update 不能更新到最新版本的问题

项目中用到的iOSDFULibrary 在xcode8里每次都提示要进行Swift2 ->Swift 3.0的转换,但是每次执行pod update,这个库都没有更新。难道是Nordic Semiconductor 偷懒吗。今天打开 IOS-nRF-Toolbox的github主页,发现

The nRF Toolbox is a container app that stores your Nordic Semiconductor apps for Bluetooth Smart in one location.
New in v4.1:
The application is now Fully migrated to Swift3.0
Bugfix: Importing of distribution packets via email no longer crashes
Bugfix: Glucose monitor demo no longer crashes/displays incorrect timestamps when the device uses the 12 hour format locale
Bugfix: Glucose monitor demo no longer duplicates data on the last row when refresh button is tapped

霍,已经更新了啊,更新之后打开Podfile.lock

use_frameworks!
target "nRF Toolbox" do
    pod 'iOSDFULibrary', '~> 2'
    pod 'EVReflection', :git => 'https://github.com/evermeer/EVReflection.git', :branch => 'Swift3'
    pod 'SWRevealViewController'
    pod 'CorePlot', '~> 2.2'
end

修改项目中的Podfile.lock,
命令行执行:

 pod update --verbose --no-repo-update

报错:

[!] Unable to satisfy the following requirements:

- `iOSDFULibrary (~> 2)` required by `Podfile`

百度了一下,是找不到符合的版本,执行:

pod search iOSDFULibrary

查询iOSDFULibrary版本号,结果是

iOSDFULibrary (0.1.11)
This repository contains a tested library for iOS 8+ devices to perform
Device Firmware Update on the nRF5x devices
pod 'iOSDFULibrary', '~> 0.1.11'

  • Homepage: https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library
  • Source: https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library.git
  • Versions: 0.1.11, 0.1.10, 0.1.9, 0.1.8, 0.1.7, 0.1.6, 0.1.5, 0.1.4 [master
    repo]

好奇怪,没有2.0版本?不应该啊,于是百度pod search 得不到最新版本的原因,发现了解决办法 : 这里

  1. 执行 pod repo update更新本地仓库,本地仓库完成后,即可搜索到指定的第三方库,但是我得到的结果是

Updating spec repo master
CocoaPods 1.1.0.beta.1 is available.
To update use: gem install cocoapods --pre
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
[!] CocoaPods was not able to update the master repo. If this is an unexpected issue and persists you can inspect it running pod repo update --verbose

这是什么鬼,更新不了?我又按提示的,执行:pod repo update --verbose,结果是

Updating spec repo master
$ /usr/bin/git pull --ff-only
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
CocoaPods 1.1.0.beta.1 is available.
To update use: gem install cocoapods --pre
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
[!] CocoaPods was not able to update the master repo. If this is an unexpected issue and persists you can inspect it running pod repo update --verbose

查找无果,也只能放弃了

  1. 换用下面的方法:升级Cocoapods版本
    升级方法:
$ sudo gem update --system  
//去掉默认更新源
$ gem sources --remove https://rubygems.org/  
//使用淘宝源
$ gem sources -a https://ruby.taobao.org/ 
$ sudo gem install cocoapods
$ pod setup

但是在gem install cocoa pods这一步里又出错了:

ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

按照stackoverflow里的答案更改为:

sudo gem install -n /usr/local/bin cocoapods

这下就可以啦,接着执行:$ pod setup
出现结果:

Setting up CocoaPods master repo
Performing a deep fetch of the master specs repo to improve future performance

下面就是漫长的等待 ,可等到最后出现:

[!] /usr/bin/git fetch --unshallow
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': transfer closed with outstanding read data remaining

我靠,再次陷入了僵局,又是各种查,有的说是可能只是网络原因。。。于是我就再试一次,还真好了!
成功了之后,虽然我检查版本号并没有变,但执行

pod search iOSDFULibrary

的结果终于正常了!:

iOSDFULibrary (2.1.2)
   This repository contains a tested library for iOS 8+ devices to
   perform Device Firmware Update on the nRF5x devices
   pod 'iOSDFULibrary', '~> 2.1.2'
   - Homepage:
   https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library
   - Source:  
   https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library.git
   - Versions: 2.1.2, 2.1.1, 2.1, 2.0.1, 2.0, 1.0.12, 1.0.11, 1.0.8,
   0.1.11, 0.1.10, 0.1.9, 0.1.8, 0.1.7, 0.1.6, 0.1.5, 0.1.4 [master
   repo]

下面就可以愉快的更新库啦

你可能感兴趣的:(解决pod update 不能更新到最新版本的问题)