1.掃碼
?AVCaptureDevice* device;? 獲取設(shè)備
AVCaptureDeviceInput* input? ?輸入
AVCaptureMetadataOutput* output 輸出
AVCaptureSession* session;? ?鏈接輸入和輸出的橋梁
AVCaptureVideoPreviewLayer* preview? 掃碼的界面的layer
- (void)captureOutput:(AVCaptureOutput*)captureOutput didOutputMetadataObjects:(NSArray*)metadataObjects fromConnection:(AVCaptureConnection*)connection?
從這里面獲取掃碼的結(jié)果
2.識(shí)別相冊里的二維碼
CIDetector*detector 獲取圖片中的信息
CIDetector*detector = [CIDetectordetectorOfType:CIDetectorTypeQRCode
context:[CIContextcontextWithOptions:nil]
options:detectorOptions];
?
具體的實(shí)現(xiàn)在demo?
https://github.com/hkkh/KHQRManger.git?
// 代碼可能有問題 需要可以自己修改
?