Recent projects to use a function: by scanning the bank card, to obtain the bank card number, after the online search, chose the Card.io this SDK, the process is as follows:
(1) Download Card.io
Card.io is a phone camera to get credit card information, the middle of the use of OCR (optical character recognition) scanning technology to return results, it also launched the SDK (software Development Kit), so that developers can add card.io to their own applications. The latest SDK can be downloaded from Https://github.com/paypal/PayPal-iOS-SDK
(2) Add to Project
1, drag the downloaded SDK package named Cardio to the project, in Targets-build Phases-link Binary with Librarys Add the following dependent library
* Audiotoolbox
* Avfoundation
* Coregraphics
* CoreMedia
* Corevideo
* Foundation
* Mobilecoreservices
* Opengles
* Quartzcore
* Security
* UIKit
If it is a XCODE5 or an updated version, just add the following library
* Avfoundation
* Audiotoolbox
* CoreMedia
* Mobilecoreservices
and make sure that both of the build settings are yes:
* Enable Modules (C and Objective-c)
* Link Frameworks automatically
2.Add in Targets-build settings -lc++ to other Linker Flags
(3) Use
I'm using it as a Viewcontroller class
Code:
Import
#import "CardIO.h"
#import "CardIOPaymentViewControllerDelegate.h"
-(void) Viewwillappear: (BOOL) Animated {
[Super viewwillappear:animated];
[Cardioutilities preload];
}
Start scanning
-(Ibaction) Scancard: (ID) sender
{
Cardiopaymentviewcontroller *scanviewcontroller = [[Cardiopaymentviewcontroller alloc] Initwithpaymentdelegate:self ];
[Self Presentviewcontroller:scanviewcontroller animated:yes completion:nil];
}
Here is the Proxy method
Cancel Scan
-(void) Userdidcancelpaymentviewcontroller: (Cardiopaymentviewcontroller *) Scanviewcontroller
{
NSLog (@ "User canceled payment info");
Handle User Cancellation here ...
[Scanviewcontroller Dismissviewcontrolleranimated:yes Completion:nil];
}
Scan complete
-(void) Userdidprovidecreditcardinfo: (cardiocreditcardinfo *) Info inpaymentviewcontroller: ( Cardiopaymentviewcontroller *) Scanviewcontroller
{
//Scan results
NSLog (@ "Received card info. Number:%@, expiry:%02i/%i, CVV:%@. ", Info.redactedcardnumber, Info.expirymonth, Info.expiryyear, INFO.CVV);
Use the card info ...
[Scanviewcontroller Dismissviewcontrolleranimated:yes Completion:nil];
}
IOS:card.io use