iOS CocoaPods 版本安装问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS CocoaPods 版本安装问题相关的知识,希望对你有一定的参考价值。

今天安装salesforce中的pods,这是里面的podfile

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

target Hellow2 do

source https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git # need to be first 
source https://github.com/CocoaPods/Specs.git

pod React, :path => ./node_modules/react-native, :subspecs => [
    ART,
    RCTActionSheet,
    RCTAdSupport,
    RCTCameraRoll,
    RCTGeolocation,
    RCTImage,
    RCTNetwork,
    RCTPushNotification,
    RCTSettings,
    RCTText,
    RCTVibration,
    RCTWebSocket,
    RCTLinkingIOS
]

pod SalesforceSDKCore
pod SalesforceNetwork
pod SalesforceRestAPI
pod SmartStore
pod SmartSync
pod SalesforceReact

end
pod ‘SalesforceSDKCore‘ 这种写法应该就是使用最新的版本,但是我使用pod install时,控制台有如下输入:
技术分享

 显示的是4.2.0版本,之后我去https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git 查看了一下,最新的版本是4.3.1

 

原来,虽然profile里有source ‘https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git‘,但是,这并不能保证本地的pods的 spec repo(描述仓库)是新的,我们需要手动运行pod repo update 更新pods 的 spec repo,这样系统才能从 spec repo中找到新版本的spec,进而才能下载到新的库。

升级后,再运行 pod install 有下图:

技术分享

已经可以正确读取新的 spec文件了!

 

在运行pod install 之前,最好在工程目录下运行 pod repo update,更新pod的 spec 信息。

 

以上是关于iOS CocoaPods 版本安装问题的主要内容,如果未能解决你的问题,请参考以下文章