【问题标题】:CocoaPods issues while adding a new pod添加新 pod 时出现 CocoaPods 问题
【发布时间】:2017-11-16 09:19:40
【问题描述】:

我的 CocoaPods 工作正常,直到我尝试安装一个新的。
如果我尝试安装一个新的 pod,那么图表 pod 中会出现几个问题,否则它可以正常工作。
我如何解决它?

错误显示如下:

我的 podfile 如下:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
use_frameworks!

target 'Tranquil' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks

# Pods for TranquillocationText
pod 'GooglePlaces'
pod 'UICircularProgressRing'
pod 'Alamofire', '~> 4.0' . //if i try to add this pod then error occurs
pod 'Charts'
end

【问题讨论】:

  • NSAttributedStringKey 闻起来有 Swift 4 的味道。虽然您似乎只使用 Swift 3。因此,正如您为 Alamofire 添加 '~> 4.0' 所做的那样,添加与 Swift 3 兼容的版本。据此:github.com/danielgindi/Charts/releases 应该是标记为3.0.3 的版本。

标签: ios swift cocoapods swift4 ios-charts


【解决方案1】:

注意:确保项目的 swift 语言版本。以下是您如何查看/检查您的 swift 语言版本的方法。


您有两个选项可以作为您的查询的解决方案:

  1. 如果您的项目有 Swift 版本 4.0
    - 您应该选择/下载与您项目的 swift 语言兼容的 POD(分享我 POD 信息和 swift 版本,以便我可以为您提供适合项目的 pod 库的确切 pod 版本版本)。

  2. 如果您的项目的 Swift 版本低于 4.0
    - 您需要将您的项目迁移到 Swift 4.0(如果您尚未迁移它)。这是参考问答,如何从 swift(下)


根据您在问题中添加的快照 - Swift 3.x 是您当前的项目语言版本,pod 'Charts' 支持 swift 4。

pod 'Charts'

这里是支持 Swift 4.0 以下版本的先前版本列表。

https://github.com/danielgindi/Charts/releases

尝试以前版本的 cosmos,例如:

pod 'Charts', '~> 3.0.3'
// or
pod 'Charts', '~> 3.0.2'
// or
pod 'Charts', '~> 3.0.1'

'

您可以从这里找到以前版本的 Alamofire(支持 4.0 以下的 Swift)-Alamofire - Releases

Swift 3.2试试这个看看:

platform :ios, '9.0'
use_frameworks!

target 'Tranquil' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks

# Pods for TranquillocationText
pod 'GooglePlaces'
pod 'UICircularProgressRing', '~> 1.7'
pod 'Alamofire', '~> 4.0'
pod 'Charts', '3.0.3'
pod 'SwiftyJSON', '3.0.0'

end

【讨论】:

  • 还是一样。
  • 谢谢。我刚试过,它有效! # Uncomment the next line to define a global platform for your project platform :ios, '9.0' use_frameworks! target 'Tranquil' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks # Pods for TranquillocationText pod 'GooglePlaces' pod 'UICircularProgressRing', '~> 1.7' pod 'Alamofire', '~> 4.0' pod 'Charts', '3.0.3' pod 'SwiftyJSON', '3.0.0' end
【解决方案2】:

转到目标“Tranquil”的构建设置,然后转到“Swift 语言版本”部分并将其设置为“Swift 4.0”。接下来,使用命令“pod install”重新安装您的 pod。接下来,重建您的项目。

【讨论】:

  • 谢谢。但我想留在'Swift 3.2'
猜你喜欢
  • 1970-01-01
  • 2022-07-11
  • 1970-01-01
  • 1970-01-01
  • 2020-08-12
  • 2013-12-16
  • 2020-01-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多