在iOS中扫描银行卡得到 银行卡的基本信息,暂时只支持 建行
2015-11-04 15:12
537 查看
iOS:card.io使用
最近朋友说要做一个通过扫描银行卡,获取到一些基本信息,如账号,然后就百度了下,最后就选中了card.io这个SDK
(1)下载Card.io
Card.io是让手机摄像头获取信用卡的信息,中间利用了OCR(光学字符识别)的扫描技术返回结果,它还推出了SDK(软件开发包),让开发者们可以把card.io添加到自己的应用当中。可以在https://github.com/paypal/PayPal-iOS-SDK下载最新的SDK
(2)添加到项目里
1、将下载的SDK包里名为CardIO的文件拖到工程里,在TARGETS-Build Phases - Link Binary With Librarys添加下面依赖库
* AudioToolbox
* AVFoundation
* CoreGraphics
* CoreMedia
* CoreVideo
* Foundation
* MobileCoreServices
* OpenGLES
* QuartzCore
* Security
* UIKit
如果是xcode5或者更新的版本,只需要添加下面的库
* AVFoundation
* AudioToolbox
* CoreMedia
* MobileCoreServices
并且保证Build Settings里面这两项都是YES:
* Enable Modules (C and Objective-C)
* Link Frameworks Automatically
2、在TARGETS-Build Settings添加 -lc++到Other Linker Flags
(3)使用
我是把它作为一个viewController类使用
代码:
导入
#import "CardIO.h"
#import "CardIOPaymentViewControllerDelegate.h"
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[CardIOUtilities preload];
}
//开始扫描
- (IBAction)scanCard:(id)sender
{
CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
[self presentViewController:scanViewController animated:YES completion:nil];
}
下面是代理方法
//取消扫描
- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)scanViewController
{
NSLog(@"User canceled payment info");
// Handle user cancellation here...
[scanViewController dismissViewControllerAnimated:YES completion:nil];
}
//扫描完成
-(void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)scanViewController
{
//扫描结果
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];
}
现在是已经基本完毕了
最近朋友说要做一个通过扫描银行卡,获取到一些基本信息,如账号,然后就百度了下,最后就选中了card.io这个SDK
(1)下载Card.io
Card.io是让手机摄像头获取信用卡的信息,中间利用了OCR(光学字符识别)的扫描技术返回结果,它还推出了SDK(软件开发包),让开发者们可以把card.io添加到自己的应用当中。可以在https://github.com/paypal/PayPal-iOS-SDK下载最新的SDK
(2)添加到项目里
1、将下载的SDK包里名为CardIO的文件拖到工程里,在TARGETS-Build Phases - Link Binary With Librarys添加下面依赖库
* AudioToolbox
* AVFoundation
* CoreGraphics
* CoreMedia
* CoreVideo
* Foundation
* MobileCoreServices
* OpenGLES
* QuartzCore
* Security
* UIKit
如果是xcode5或者更新的版本,只需要添加下面的库
* AVFoundation
* AudioToolbox
* CoreMedia
* MobileCoreServices
并且保证Build Settings里面这两项都是YES:
* Enable Modules (C and Objective-C)
* Link Frameworks Automatically
2、在TARGETS-Build Settings添加 -lc++到Other Linker Flags
(3)使用
我是把它作为一个viewController类使用
代码:
导入
#import "CardIO.h"
#import "CardIOPaymentViewControllerDelegate.h"
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[CardIOUtilities preload];
}
//开始扫描
- (IBAction)scanCard:(id)sender
{
CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
[self presentViewController:scanViewController animated:YES completion:nil];
}
下面是代理方法
//取消扫描
- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)scanViewController
{
NSLog(@"User canceled payment info");
// Handle user cancellation here...
[scanViewController dismissViewControllerAnimated:YES completion:nil];
}
//扫描完成
-(void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)scanViewController
{
//扫描结果
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];
}
现在是已经基本完毕了
相关文章推荐
- 利用字符替换进行混淆编译--参考念茜大神的杰作
- RFSegmentView在iOS7设备上不显示label的解决方案
- Nagios 搭建与配置
- IOS 开发获取沙盒路径
- isKindOfClass和isMemberOfClass的用法
- iOS--代码规范
- 关于class-dump在mac的下载和安装
- IOS安全–使用lldb对应用进行运行时分析
- IOS学习之block结构的简单用法和typedef的结合用法(block后面内容还没有看呢...)
- iOS正则表达式
- class_respondsToSelector
- iOS开发 动画效果
- class_getInstanceMethod和class_getClassMethod
- IOS AssetsLibrary框架的使用
- iOS加载动画gif方案
- 苹果开发 笔记(87)coreData
- ios7以上系统隐藏状态栏方法
- iOS生成随机数
- iOS Info.plist
- iOS语音播放之切换听筒和扬声器的方法解决方案