搜尋

首頁  >  問答  >  主體

ios 原生方法如何识别相册图片二维码

如题,请问ios如何通过原生的方法实现,识别相册图片中的二维码?不考虑版本兼容,不适用第三方

PHPzPHPz2894 天前640

全部回覆(2)我來回復

  • 迷茫

    迷茫2017-04-17 17:58:33

    搬運工又來了: http://stackoverflow.com/questions/28317071/scan-qrcode-and-barcode-from-camera-and-image-which-picked-from-image-library-in

    qrCodeImageView.image=qrcodeImg
    
    var detector:CIDetector=CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy:CIDetectorAccuracyHigh])
    var decode=""
    var ciImage:CIImage=CIImage(image:qrcodeImg)
    qrCodeLink=""
    
    let features=detector.featuresInImage(ciImage)
    for feature in features as! [CIQRCodeFeature] {
       qrCodeLink += feature.messageString
    }
    
    if qrCodeLink=="" {
        println("nothing")
    }else{
        println("message: \(qrCodeLink)")
    }

    回覆
    0
  • PHP中文网

    PHP中文网2017-04-17 17:58:33

    https://github.com/wangruocong/RoyQRcode
    可以參考下,純原生寫的。

    回覆
    0
  • 取消回覆