zoukankan      html  css  js  c++  java
  • 银行卡扫描(基于swift)

    ①下载CardIO库

    ②将库文件解压,拖入工程,务必按下图勾选

    ③选中项目,target-->build Setting-->All    Other Linker Flags
        双击“+”,添加语句“-lc++”
    ④General,找到Linked Frameworks and libtaries
      添加库:
      AVFoundation
      AudioToolbox
      CoreMedia
      MobileCoreServices
      libCardIO.a
    ⑤CardScanner-->newfile-->Objective-c-->file-->CardBridgingHeader-->Finish-->Yes
      将.m文件删除
      在.h中# import "CardIO.h"
    ⑥Storyboard中
      1, 拖控件一个button和一个label分别创建button的方法和label的属性
      2,继承协议CardIOPaymentViewControllerDelegate并实现协议里的两个方法
        //用户取消扫描
          func userDidCancelPaymentViewController(paymentViewController: CardIOPaymentViewController!) {
              result.text = "Scan cancel"
              //关闭窗口
              paymentViewController.dismissViewControllerAnimated(true, completion: nil)
          }
          //用户确认扫描
          func userDidProvideCreditCardInfo(cardInfo: CardIOCreditCardInfo!, inPaymentViewController paymentViewController: CardIOPaymentViewController!) {
              if let card = cardInfo{
                  result.text = "卡号:(card.cardNumber) 过期年月:(card.expiryYear)年(card.expiryMonth)月 CVV:(card.cvv)"
              }
              paymentViewController.dismissViewControllerAnimated(true, completion: nil)
          }
      3,扫描按键的方法    
        @IBAction func startsacn(sender: AnyObject) {
             let cardvc = CardIOPaymentViewController(paymentDelegate: self)
              cardvc.modalPresentationStyle = UIModalPresentationStyle.FormSheet
              presentViewController(cardvc, animated: true, completion: nil)
          }
      4,真机调试可能会报错,关闭bitcode
        项目-->Build Setting-->All -->Enable Bitcode-->No
  • 相关阅读:
    使用IntelliJ IDEA配置Tomcat(入门)
    关于hive异常:Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStor
    完整过程解决 ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: NO)
    Hadoop伪分布式配置
    Spark_scala_Maven项目创建
    Spark-WordCount
    tesseract-ocr的安装及使用
    解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in P
    python第三方库资源
    kafka伪分布式配置
  • 原文地址:https://www.cnblogs.com/luoxiaoxi/p/5044509.html
Copyright © 2011-2022 走看看