3.Enum case '...' not found in type '...'
解决好上面两个报错,编译程序时还会显示这个error,具体场景如下:
PosVisitQuestionType: String {
case text
case textArea = "text_area"
case dropDownList = "drop_down_list"
case radioButton = "radio_button"
}
let type: PosVisitQuestionType!
...
switch type {
case .text, .textArea:
errorText = NSLocalizedString("Please enter the following options", comment: "")
case .dropDownList, .radioButton:
errorText = NSLocalizedString("Click the right button to get current location", comment: "")
default:
break
}
Xcode10建议每个case 情况下加“?”
原因可能是 type是可选的,所以每个case情况要与type类型保持一致,所以提示加 “?”,可能是Xcode10编译器更新的原因。
修改的方法是如果确定type会被赋值,那在定义的时候就把“!”去掉,如果不确定type是否有值就按照Xcode提示修改。
4.适配iPhone XS Max、iPhone XR
我们项目在获取机型等信息用的是DeviceKit这个第三方库,所以也需要更新一下才能获取到新机型的信息,最新版是1.8.1。在最新版有这样一个变量
/// All Face ID Capable Devices
static public var allFaceIDCapableDevices: [Device] {
return [.iPhoneX, .iPhoneXs, .iPhoneXsMax, .iPhoneXr]
}











