简体   繁体   English

SwiftDate 5.0编译问题

[英]SwiftDate 5.0 compilation issues

When I install SwiftDate through Cocoapods and try to build my project, I get three errors from the SwiftDate library: 当我通过Cocoapods安装SwiftDate并尝试构建项目时,我从SwiftDate库中遇到了三个错误:

/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion.swift:11:15: Type 'DateInRegion' does not conform to protocol 'Hashable' /Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion.swift:11:15:类型“ DateInRegion”不符合协议“哈希”

/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Create.swift:50:33: Type 'UInt32' has no member 'random' /Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Create.swift:50:33:类型“ UInt32”没有成员“随机”

/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Create.swift:65:37: Type 'UInt32' has no member 'random' /Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Create.swift:65:37:类型“ UInt32”没有成员“随机”

Am I using an incorrect version of SwiftDate, Swift, or XCode? 我使用的SwiftDate,Swift或XCode版本不正确吗? When I try to install SwiftDate 4.5.1, I get no errors in the library but none of the SwiftDate functions actually work. 当我尝试安装SwiftDate 4.5.1时,库中没有出现任何错误,但是SwiftDate函数实际上没有起作用。

As per SwiftDate release notes the latest version is using Swift 4.2 (starting from 5.0.9) so I assume that you are using an older version of Swift. 根据SwiftDate 发行说明 ,最新版本正在使用Swift 4.2(从5.0.9开始),因此我假设您使用的是Swift的旧版本。

Otherwise check the migration guide for more informations. 否则,请查看迁移指南以获取更多信息。 https://github.com/malcommac/SwiftDate/blob/master/Documentation/10.Upgrading_SwiftDate4.md https://github.com/malcommac/SwiftDate/blob/master/Documentation/10.Upgrading_SwiftDate4.md

Since versions 5.0.0+ of SwiftDate include code from Swift 4.2 , you have to have installed Xcode which supports this version of Swift (Xcode 10+). 由于5.0.0+版本的SwiftDate包含来自Swift 4.2的代码,因此您必须安装支持此版本Swift(Xcode 10+)的Xcode。

Otherwise you can use the latest version of SwiftDate which doesn't use code from Swift 4.2 such as getting random number easily (SwiftDate 4.5.0) by specifing the version of cocoapod in podfile 否则,您可以使用最新版本的SwiftDate ,该版本不使用Swift 4.2中的代码,例如通过在podfile中指定cocoapod的版本来轻松获取随机数(SwiftDate 4.5.0)

pod 'SwiftDate', '4.5.0'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM