faceterteam / PayCards_iOS

Credit card scanning for mobile apps
https://pay.cards/
Other
199 stars 53 forks source link

Issue with iPhone X/XR-XS/11-11 Pro Max (iOS 13.3) #39

Open GlebZheglovZ opened 4 years ago

GlebZheglovZ commented 4 years ago

iOS: 13.3 PayCards version: 1.1.7 (Installed using Cocoapods)

Issue Description: When the card is scanned, the camera does not detect the left and right edges of the credit card. However, it normally recognizes the upper and lower bounds. This problem is only observed on iPhone X, XR/XS, 11-11 Pro Max.

Everything works fine on iPhone 6S/SE

Founded similar problem

import Foundation
import PayCardsRecognizer

protocol CardRecognizerDelegate: class {
    func didReceivedCreditCardData(cardNumber: String,
                     cardholderName: String,
                     monthExp: String,
                     yearExp: String)
}

class CardRecognizer {

    var recognizer: PayCardsRecognizer!
    weak var delegate: CardRecognizerDelegate!

    init(forView view: UIView) {
        recognizer = PayCardsRecognizer(delegate: self,
                                        resultMode: .async,
                                        container: view,
                                        frameColor: .green)
    }

}

extension CardRecognizer: PayCardsRecognizerPlatformDelegate {
    func payCardsRecognizer(_ payCardsRecognizer: PayCardsRecognizer, didRecognize result: PayCardsRecognizerResult) {
        self.delegate.didReceivedCreditCardData(cardNumber: result.recognizedNumber ?? "",
                                  cardholderName: result.recognizedHolderName ?? "",
                                  monthExp: result.recognizedExpireDateMonth ?? "",
                                  yearExp: result.recognizedExpireDateYear ?? "")
    }
}
gosis commented 4 years ago

You can set the PayCardsRecognizer container view height to be half of the screen size as seen in the example project here https://github.com/faceterteam/PayCards_iOS