iOS倒计时

Method cannot be a member of an

2022-08-25  本文已影响0人  铁汁红豆

Swift option错误Method cannot be a member of an @objc protocol because the type of the parameter 2 cannot be represented in Objective-C解决方法

在swift中protocol如果要用optional的话必须在protocol前加@objc,比如说

 enum moreType {

    case  moreshowUnBtnMoreType

    case  moreNoUnBtnMoreType

    case  unBtnMoreType

}

Method cannot be a member of an @objc protocol because the type of the parameter 2 cannot be represented in Objective-C“`

是因为该方法中的枚举moreType没有@objc,在moreType前加上@objc,并加上raw type:Int就可以了

@objc enum moreType:Int{

    case  moreshowUnBtnMoreType

    case  moreNoUnBtnMoreType

    case  unBtnMoreType

}

上一篇下一篇

猜你喜欢

热点阅读