2016-09-14 26 views
0

用Swift3升级到Xcode8后,我发现Cocoapods不再支持这个功能。所以我将Cocoapods升级到1.1.0rc2的测试版。但是,当我尝试pd spec lint时,出现错误:Swift3的Cocoapods 1.1.0测试版

- ERROR | xcodebuild: WeatherKit/WeatherKit/DateComponents+InitFromString.swift:11:11: error: use of undeclared type 'DateComponents' 
- ERROR | [iOS] xcodebuild: WeatherKit/WeatherKit/CityLoader.swift:14:13: error: use of undeclared type 'DispatchQueue' 
- ERROR | [iOS] xcodebuild: WeatherKit/WeatherKit/CityLoader.swift:19:11: error: use of unresolved identifier 'DispatchQueue' 
- WARN | [iOS] xcodebuild: WeatherKit/WeatherKit/DirectionUnit.swift:20:15: warning: extraneous '_' in parameter: 'value' has no keyword argument name 
- WARN | [iOS] xcodebuild: WeatherKit/WeatherKit/DistanceUnit.swift:19:15: warning: extraneous '_' in parameter: 'value' has no keyword argument name 

Analyzed 1 podspec. 

[!] The spec did not pass validation, due to 20 errors and 2 warnings. 

20个错误都是关于Swift3语法的。但我使用Xcode8,它应该允许所有这些语法

有谁知道我可以用这个做什么?

回答

0

我已经通过使用1.1.0rc2版本解决了这个问题。

问题是由于错误的swift编译版本,默认是2.3,但代码是3.0。

因此改变validator.rb:

# @return [String] the SWIFT_VERSION to use for validation. 
# 
def swift_version 
    @swift_version ||= dot_swift_version || '2.3' 
end 

# @return [String] the SWIFT_VERSION to use for validation. 
# 
def swift_version 
    @swift_version ||= dot_swift_version || '3.0' 
end 

的问题解决了

0

我会尝试回到旧版本,并将podFile作为iOS 9而不是iOS 10。我假设这个错误是CocoaPods测试版中的一个错误。

+0

但是当我回滚,这表明了“ - 错误| [iOS版]未知:验证期间遇到未知错误(模拟器iPhone 4s不可用)。“ –

+0

我不认为iPhone 4S是Xcode 8 sim中的一个选项(或者它不应该是)。尝试使用iPhone SE。 –

+0

但它不能像Cocoapods那样工作。我试图将模拟器更改为iPhone5,但它仍然不起作用。但它解决了,看到我上面的答案 –