search

Home  >  Q&A  >  body text

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

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

PHPzPHPz2890 days ago633

reply all(2)I'll reply

  • 迷茫

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

    The picker is here again: 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)")
    }

    reply
    0
  • PHP中文网

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

    https://github.com/wangruocong/RoyQRcode
    You can refer to it, it is purely natively written.

    reply
    0
  • Cancelreply