faceterteam / PayCards_iOS

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

Not working on ios 13 #36

Open OttoChamo opened 4 years ago

OttoChamo commented 4 years ago

version installed: 1.1.6 ios version: 13 Hello, so I am working in application with flutter, I am using a channel to contact this library with the native code. I managed to communicate effectively with the Android SDK but in the case of this ios counterpart I haven't managed to use it, as I invoke the view controller, the camera scanner appears but It doesn't read the card.

This is my code, you'll notice that is the same as the sample.

import UIKit

import PayCardsRecognizer

class ReadCardController: UIViewController, PayCardsRecognizerPlatformDelegate {

    var recognizer: PayCardsRecognizer!

    override func viewDidLoad() {
        super.viewDidLoad()
        recognizer = PayCardsRecognizer(
            delegate: self,
            resultMode: .sync,
            container: self.view,
            frameColor: .green
        )
        // Do any additional setup after loading the view.
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        recognizer.startCamera()
    }

    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)

        recognizer.stopCamera()

    }

   // never gets called
    func payCardsRecognizer(_ payCardsRecognizer: PayCardsRecognizer, didRecognize result: PayCardsRecognizerResult) {
        print("this the result: \(result)")
    }

    // never gets called
    func payCardsRecognizer(_ payCardsRecognizer: PayCardsRecognizer, didCancel result: PayCardsRecognizerResult?) {

        print("did cancel function :c")
    }

}
saitbnzl commented 4 years ago

@OttoChamo You probably still include the old version of the framework to your plugin. I've fixed this problem in flutter_paycards plugin(0.2.0). I use this fork to build the framework for the plugin. I've merged the latest commits from original repo to my fork of ios source, reproduced the framework, updated the plugin and the issue is fixed in my tests.

https://github.com/saitbnzl/flutter_paycards/issues/4

yanCerv commented 4 years ago

the delegates doesn't work, just install by cocoapods, in Xcode 11.2.1 iOS 13

Git-Santhosh commented 4 years ago

I updated the latest cocoa pods for iOS 13 it can be scanning the cards but it not called delegate methods

GlebZheglovZ commented 4 years ago

I updated the latest cocoa pods for iOS 13 it can be scanning the cards but it not called delegate methods

Same

DanSavi commented 4 years ago

I had the same issue, just change the resultMode to async. recognizer = PayCardsRecognizer( delegate: self, resultMode: .async, container: self.view, frameColor: .green )

vitkuzmenko commented 4 years ago

Hello! Please, install latest version v1.1.7.

MirshodRaupov commented 4 years ago

The framework doesn't recognize non embossed cards, If you have any solution, please share! I leave my gmail m.raupovios6766@gmail.com

tchernitski commented 4 years ago

There is no such solution right now. We will retrain neural network to handle non embossed cards but I don't have exact date yet.

MirshodRaupov commented 4 years ago

Thank you bro for answering my question! by the way such a good framework! I've been looking for a solution which is scan both non embossed and embossed for two weeks. I've also reviewed other types of libraries! But I couldn't find what I needed. I think you are good programmer! Can you point me in the right direction?

MohamedElabd92 commented 4 years ago

Thank you bro for answering my question! by the way such a good framework! I've been looking for a solution which is scan both non embossed and embossed for two weeks. I've also reviewed other types of libraries! But I couldn't find what I needed. I think you are good programmer! Can you point me in the right direction?

@MirshodRaupov You can use CardScan-iOS library, it is working for me in scanning both embossed and non embossed cards.

CarlosCaceres86 commented 4 years ago

Hello, I have a similar issue but with a native iOS app. I am using the last version (1.1.7) and the resultMode is set to .async. But still, the recognition do not recognise any card. Sometimes (1 out of 20) the card is recognise, but it takes a lot of effort to align the card. I paste here my code so u can see that everything is ok:

`class CardRecognizerViewController: BaseViewController {

// MARK: Properties
// MARK: Public
// MARK: Internal
var newCardDelegate: NewCardProtocol?
// MARK: Private
private let disposeBag = DisposeBag()
private var recognizer: PayCardsRecognizer!

// MARK: Outlets
@IBOutlet weak var backBtn: UIButton!
@IBOutlet weak var recognizerContainer: UIView!

// MARK: Overrides
override func viewDidLoad() {
    super.viewDidLoad()

    configureObservers()
    initComponents()
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    recognizer.startCamera()
}

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)
    recognizer.stopCamera()
}

// MARK: Observers
private func configureObservers() {
    configureInputs()
    configureOutputs()
}

private func configureInputs() {
    disposeBag.insert(
        backBtn.rx.tap
            .bind { [weak self] in
                guard nil != self else { return }
                self!.dismissView()
            }
    )
}

private func configureOutputs() {

}
// MARK: Functions
// MARK: Public
// MARK: Internal
// MARK: Private
private func initComponents() {
    recognizer = PayCardsRecognizer(delegate: self, resultMode: .async, container: recognizerContainer, frameColor: .white)
    recognizer.setOrientation(.portrait)
}

} // CardRecognizerViewController

extension CardRecognizerViewController: PayCardsRecognizerPlatformDelegate {

func payCardsRecognizer(_ payCardsRecognizer: PayCardsRecognizer, didRecognize result: PayCardsRecognizerResult) {

    #if DEBUG
        print("CARD RECOGNIZED:")
        print(result.recognizedNumber ?? "")
        print(result.recognizedExpireDateYear ?? "")
        print(result.recognizedExpireDateMonth ?? "")
        print(result.recognizedHolderName ?? "")
    #endif

    let card = CardModel(number: result.recognizedNumber ?? "",
                         expMonth: result.recognizedExpireDateMonth,
                         expYear: result.recognizedExpireDateYear,
                         holderName: result.recognizedHolderName)
    newCardDelegate?.onCardRecognized(card: card)
    dismissView()
}

} // PayCardsRecognizerPlatformDelegate `