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)")
}
搬运工又来了: http://stackoverflow.com/questions/28317071/scan-qrcode-and-barcode-from-camera-and-image-which-picked-from-image-library-in
https://github.com/wangruocong/RoyQRcode
可以参考下,纯原生写的。