Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to setup camera to scan credit card #1659

Closed
webcpu opened this issue Oct 3, 2020 · 4 comments
Closed

Failed to setup camera to scan credit card #1659

webcpu opened this issue Oct 3, 2020 · 4 comments
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@webcpu
Copy link

webcpu commented Oct 3, 2020

Summary

I tried to add a card. When I tapped "Scan card" button, I got an error immediately. It failed to create VNRecognizeTextRequest.

NSError * domain: @"com.apple.vis" - code: 3 0x00000002803d40c0
@"NSLocalizedDescription" : @"Operation failed due to attempt to crop zero or near zero dimensioned area"

Code to reproduce

STPCardScanner.m

- (void)setupCamera {
    __weak typeof(self) weakSelf = self;
    self.textRequest = [[VNRecognizeTextRequest alloc] initWithCompletionHandler:^(VNRequest * _Nonnull request, NSError * _Nullable error) {
        __strong typeof(self) strongSelf = weakSelf;
        if (!strongSelf.isScanning) {
            return;
        }
        if (error) {
            [strongSelf stopWithError:[STPCardScanner stp_cardScanningError]];
            return;
        }
        [strongSelf processVNRequest:request];
    }];

iOS version

iOS 14.1

Installation method

Swift Package Manager

SDK version

20.0.0

Other information

@davidme-stripe
Copy link
Contributor

Thanks for the report! I think I see the problem: We're not setting up the cropping rect properly when the device orientation is UIDeviceOrientationUnknown. I'll put out a patch soon. Does it work when you rotate the device to landscape?

If that's not it, it could help if we had more information about your configuration:

  • What device are you running this on?
  • Does the app have camera permissions?
  • Do other camera-using apps work?

@davidme-stripe davidme-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Oct 5, 2020
@webcpu
Copy link
Author

webcpu commented Oct 6, 2020

Thanks! The UI only supports portrait mode and it was in portrait mode.
What device are you running this on? iPhone XR
Does the app have camera permissions? Yes
Do other camera-using apps work? Yes

@davidme-stripe
Copy link
Contributor

I think this was fixed by #1661, which we'll try to get in a release soon. Can you try the latest master branch?

@davidme-stripe
Copy link
Contributor

This should be fixed in SDK 20.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

2 participants