我遵循了card.io的所有说明。
摄像头出现时看起来像是在扫描,但从未通过delegate
. 我错过了什么吗?
即使我尝试该示例并输入我的应用程序 ID,它也不会扫描。我是否只需要等待很长时间才能进行扫描?
这是我的代码
.h 文件
@interface MasterCheckoutCreditCardViewController : UIViewController<CardIOViewDelegate>
.m 文件
- (void)viewDidLoad {
[super viewDidLoad];
if (![CardIOView canReadCardWithCamera]) {
NSLog(@"troubles in paradise");
}
CardIOView* cioView = [[CardIOView alloc]initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 200)];
cioView.appToken = @"app_token";
cioView.delegate = self;
cioView.guideColor = [UIColor whiteColor];
[self.view addSubview:cioView];
}
-(void)cardIOView:(CardIOView *)cardIOView didScanCard:(CardIOCreditCardInfo *)cardInfo {
if (cardInfo) {
// The full card number is available as info.cardNumber, but don't log that!
NSLog(@"Received card info. Number: %@, expiry: %02i/%i, cvv: %@.", cardInfo.redactedCardNumber, cardInfo.expiryMonth, cardInfo.expiryYear, cardInfo.cvv);
// Use the card info...
}
}