本文主要是介绍iOS开发之信用卡 扫描识别卡号信息(card.io),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
使用CocoaPods
pod 'CardIO'
或者Demo下载https://github.com/AllLuckly/card.io-iOS-SDK
Xcode版本: Xcode 7.2.1
导入如下所示的库
Accelerate.framework
MobileCoreServices.framework
CoreMedia.framework
AudioToolbox.framework
AVFoundation.framework
导入头文件
#import <CardIO.h>
#import <CardIOPaymentViewControllerDelegate.h>
实现部分:
// 需要签协议: CardIOPaymentViewControllerDelegate
- (void)click:(UIButton *)sender
{CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];// 进行简单的设置scanViewController.hideCardIOLogo = YES;scanViewController.collectCVV = NO;scanViewController.collectExpiry = NO;[self presentViewController:scanViewController animated:YES completion:nil];
}
Delegate
//取消扫描
- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)scanViewController{[scanViewController dismissViewControllerAnimated:YES completion:nil];}//扫描完成
-(void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)scanViewController
{//扫描结果NSLog(@"Received card info. Number: %@, expiry: %02ld/%ld, cvv: %@.%@", info.cardNumber, (unsigned long)info.expiryMonth, (unsigned long)info.expiryYear, info.cvv);// 这里可以自己进行一些处理///[scanViewController dismissViewControllerAnimated:YES completion:nil];
}
这篇关于iOS开发之信用卡 扫描识别卡号信息(card.io)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!