2017-08-22 58 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") 
    }