【问题标题】:card.io does not scancard.io 不扫描
【发布时间】:2015-09-16 13:44:47
【问题描述】:

试图将 Card.io (v. 5.1.1) 集成到我的应用程序中,但在 iPhone4 iOS v. 7.1.2 中遇到了非常奇怪的问题。当它启动相机时:

  1. 它不会使相机自动对焦
  2. 如果我用东西盖住相机,它不会打开闪光灯
  3. 当我将卡放入绿色角框时,它什么也不做。没有出现垂直/水平线。只有一些屏幕时不时滞后

奇怪的是,当我安装 card-io-sampleApp 时,它可以在具有相同卡的同一设备上完美运行。超级有氧运动也很完美。将 card-io-sampleApp 控制器添加到我的应用程序中没有任何区别。

    (IBAction)scanButtonPressed:(id)sender
{
    CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
    scanViewController.disableManualEntryButtons = YES;
    scanViewController.suppressScanConfirmation = YES;
    scanViewController.scannedImageDuration = 0.5f;
    scanViewController.collectExpiry = NO;
    scanViewController.scanExpiry = NO;

    [self presentViewController:scanViewController animated:YES completion:nil];
}

(void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)scanViewController
{
    [scanViewController dismissViewControllerAnimated:YES completion:nil];
}

 (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo )info inPaymentViewController:(CardIOPaymentViewController )scanViewController
{
    if (info.cardNumber.length > 0) {
        self.numberField.text = info.cardNumber;
    }
    [scanViewController dismissViewControllerAnimated:YES completion:nil];
}

我错过了什么? 该应用程序还使用相机进行二维码扫描。这可能是问题吗?也许还有其他冲突?

谢谢!

【问题讨论】:

    标签: ios iphone card.io


    【解决方案1】:

    我发现了在 iOS 7 上可能导致此行为的原因

    如果您在某处实例化 CardIOPaymentViewController 有无限动画,它将无法正常工作。

    导致问题的代码sn-p

    - (void)animate:(UIView *)v
    {
    
            [UIView animateWithDuration:.8 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^ {
               // some animation
            } completion:^(BOOL finished) {
                   [self animate:v];
            }];
    }
    

    因此,当您展示扫描仪或控制器消失时,请停止动画。

    - (void) viewDidDisappear:(BOOL)animated {
        // stop animation here
    }
    

    希望对你有帮助

    【讨论】:

    • 是的,这就是问题所在!谢谢!
    • 我有同样的问题,但是如何实现这个解决方案,我没有在这个控制器中使用任何动画。
    • @Ashiwani,有些东西阻塞了你的主线程——这就是相机无法对焦的原因。检查您的代码 - 至少,创建空项目示例并确保 cardIO 的代码正常工作。而不是返回您的项目并注释所有不属于 cardIO 的代码
    猜你喜欢
    • 2015-11-09
    • 1970-01-01
    • 1970-01-01
    • 2014-07-09
    • 1970-01-01
    • 2017-05-18
    • 2015-07-21
    • 2013-11-19
    • 1970-01-01
    相关资源
    最近更新 更多