swift 3.0 和 xcode 8.0 中未显示 sinch 验证方法
sinch verification method not showing in swift 3.0 and xcode 8.0
我们正在使用 pods 与 swift 3.0 和 xcode 8.0 的 sinch 验证。我想调用 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)
}
}
它应该是这样的
let verification = SMSVerification(applicationKey:"<APP KEY>", phoneNumber: phoneNumberInE164)
verification.initiate { (result: InitiationResult, error: NSError?) -> Void in
// handle outcome
}
不确定为什么转换为 SIN 验证,但我认为错误是您的结果是布尔值,但它是启动结果
我们正在使用 pods 与 swift 3.0 和 xcode 8.0 的 sinch 验证。我想调用 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)
}
}
它应该是这样的
let verification = SMSVerification(applicationKey:"<APP KEY>", phoneNumber: phoneNumberInE164)
verification.initiate { (result: InitiationResult, error: NSError?) -> Void in
// handle outcome
}
不确定为什么转换为 SIN 验证,但我认为错误是您的结果是布尔值,但它是启动结果