Sinch标注验证:未对输入“1”进行验证

时间:2018-04-09 08:05:57

标签: ios objective-c sinch sinch-verification

我正在尝试将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.
                }
            }
        }];
  • iOS版本:11.2.6
  • Xcode版本:9.2
  • 使用cocoapods安装的Sinch验证版本:2.0.6
  • 语言:目标 - C
  • 国家:巴基斯坦(PK)
  • 服务提供者:Zong(CMPak)

0 个答案:

没有答案