目前我在xcode版本10.1和swift版本4.2上。我正在使用CryptoSwift lib,当我尝试使用carthage update
时,它无法使用错误消息SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2
构建。
我正在尝试解决问题:
if swift_verion > 4.2 {
//Download x version
}else {
//Download y version
}
Build settings from command line:
CARTHAGE = YES
CLANG_ENABLE_CODE_COVERAGE = NO
CODE_SIGN_IDENTITY =
CODE_SIGNING_REQUIRED = NO
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
ONLY_ACTIVE_ARCH = NO
SDKROOT = iphoneos12.1
SKIP_INSTALL = YES
STRIP_INSTALLED_PRODUCT = NO
TOOLCHAINS = com.apple.dt.toolchain.Swift_4_2
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'CryptoSwift')
似乎CryptoSwift lib在最新版本(1.0.0)中使用Xcode 10.2更新为Swift 5。您收到此错误是因为如果要指向此新版本,则需要更新Xcode版本并将项目迁移到Swift 5。使用Swift 5的项目只能使用Xcode 10.2构建。
请注意,Apple很快就会放弃对Swift 3的支持,很快就升级它可能是一个好主意。在迁移期间管理依赖项可能会很麻烦,因为您无法控制其他开发团队何时切换。
我在Cartfile
中使用以下内容修复它:
github "krzyzanowskim/CryptoSwift" "swift42"
这使用CryptoSwift的Swift 4.2分支,您不必转换您的项目。