IOS: card. io usage

Source: Internet
Author: User

IOS: card. io usage

Recently, a function is used to scan a bank card and obtain the bank card number. After searching the Internet, the SDK card. io is used. The process is as follows:

(1) download Card. io

Card. i/O allows the mobile phone camera to obtain credit card information, and uses OCR (Optical Character Recognition) Scanning Technology to return the results. It also introduces the SDK (software development kit ), let developers put the card. i/O is added to your own application. You can download the latest SDK at https://github.com/paypal/paypal-ios-sdk.

(2) Add to project

1. Drag the downloaded CardIO file in the SDK package to the project and add the following dependent libraries in TARGETS-Build Phases-Link Binary With Librarys.

 

* AudioToolbox

* AVFoundation

* CoreGraphics

* CoreMedia

* CoreVideo

* Foundation

* MobileCoreServices

* OpenGLES

* QuartzCore

* Security

* UIKit

If it is xcode5 or an updated version, you only need to add the following Library

 

* AVFoundation

* AudioToolbox

* CoreMedia

* MobileCoreServices

Make sure that the two items in Build Settings are YES:

 

* Enable Modules (C and Objective-C)

* Link Frameworks Automatically



2. Add-lc ++ to Other Linker Flags in TARGETS-Build Settings.
(3) Use

I use 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];

}

The following is the proxy method

 

// Cancel the scan

-(Void) userDidCancelPaymentViewController :( CardIOPaymentViewController *) scanViewController

{

NSLog (@ "User canceled payment info ");

// Handle user cancellation here...

[ScanViewController dismissViewControllerAnimated: YES completion: nil];

}

// Scan completed

-(Void) userDidProvideCreditCardInfo :( CardIOCreditCardInfo *) info inPaymentViewController :( CardIOPaymentViewController *) scanViewController

{

// Scan result

NSLog (@ "Your Ed card info. number: % @, expiry: % 02i/% I, cvv: % @. ", info. redactedCardNumber, info. expiryMonth, info. expiryYear, info. cvv );

// Use the card info...

[ScanViewController dismissViewControllerAnimated: YES completion: nil];

}





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.