Мы используем синхронную проверку модулями с swift 3.0 и xcode 8.0. Я хочу вызвать методы initiate()
и verifyCode()
, но компилятор показывает value of type SINVerification? has no member
У меня есть импорт import SinchVerification
и написанный ниже код: -
let region:String = SINDeviceRegion.currentCountryCode()
let phoneNumber:SINPhoneNumber?
do {
try phoneNumber = SINPhoneNumberUtil().parse("xxxxxxxxxx", defaultRegion: region)
let phoneNumberInE164:String = SINPhoneNumberUtil().formatNumber(phoneNumber!, format: SINPhoneNumberFormat.E164)
let verification = SINVerification.smsVerification(withApplicationKey: "965010f3-bb37-4356-82ba-fea0452377d9", phoneNumber: phoneNumberInE164) as? SINVerification
verification.initiate { (success:Bool, error:Error?) -> Void in
//handle outcome
if (success){
print("successfully requested phone verification")
} else {
print(error?.localizedDescription)
}
}