使用Swift3升级到Xcode8之后,我发现Cocoapods不再支持这个了。所以我将Cocoapods升级到beta版,即1.1.0rc2。但是当我尝试pod spec lint时,错误发生了:
- 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 :(得分:0)
我会尝试回到旧版本并将podFile保留为iOS 9而不是iOS 10.我假设此错误是CocoaPods测试版中的错误。
答案 1 :(得分: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
问题解决了