2017-08-22 117 views
0

我用Xcode 9 beta制作了一个项目,现在发布它,我不得不使用Xcode 8进行存档和发布,但是当尝试使用Xcode 8构建时,出现了一些错误。 我有一个在Xcode 9中正常工作的枚举,但Xcode 8无法识别那些成员。Xcode无法识别枚举

enum TestAcceptionStatus:Int { 
case pricePending = 1 
case payReady 
case payed 
case testerPending 
case admissionRegistration 
case testerDetail 
case sampleRegistration 
case answered = 20 } 

这是错误的图像:

this is the error image

因此,任何人可以帮助我!

+0

尝试创建一个包含该值的变量,然后将switch语句应用到该 –

+0

尝试使用if if else if – Rivendell

回答

0

我找到了答案。 只是应该从开关状态中解包statusType。 这可能是一个Xcode错误,因为statusType不是可选的,但是当我在statusType的末尾添加!时,错误消失。

-1

试试这个:

let i : Int = 4 
    switch i { 
    case TestAcceptionStatus.pricePending.rawValue: 
     print("1") 
    case TestAcceptionStatus.payReady.rawValue: 
     print("2") 
    case TestAcceptionStatus.payed.rawValue: 
     print("3") 
    . 
    . 
    . 
    default: 
     print("0") 
    }