我正在尝试将Sinch Callout Verification用于我的iOS App。我已根据文档实现了代码。我接到iPhone上的电话。录制的语音告诉我“如果您没有请求此呼叫,请按1进行验证或挂断”
当我从iPhone键盘输入“1”时,没有任何反应。计算机只是不断重复以上信息。
但是当我挂断电话时,我的代码中的电话会失败。
以下是我的代码:
NSString* defaultRegion = info.countryAbbr.uppercaseString; //this is my country in upper case and its correct
NSError *parseError = nil;
id<SINPhoneNumber> phoneNumber = [SINPhoneNumberUtil() parse:[info getFullPhoneNo]
defaultRegion:defaultRegion
error:&parseError];
if (!phoneNumber){
// Handle invalid user input
}
NSString *phoneNumberInE164 = [SINPhoneNumberUtil() formatNumber:phoneNumber
format:SINPhoneNumberFormatE164];
id<SINVerification> verification = [SINVerification calloutVerificationWithApplicationKey:@"4ecb3c90-6d92-40c5-9a96-649f84fcc93e"
phoneNumber:phoneNumberInE164];
[verification initiateWithCompletionHandler:^(id<SINInitiationResult> result, NSError *error) {
[SPProgressHud hideAllHUDsForView:self.view animated:YES];
if (result.success) {
// when I enter/press "1" call should hang up and code here should run
} else {
if ([error.domain isEqualToString:SINVerificationErrorDomain] &&
error.code == SINVerificationErrorCancelled) {
// Handle cancellation error code separately
NSLog(@"Verification cancelled: %@", error);
} else {
// Inform user of error, e.g. that input was invalid.
}
}
}];