iOS自带方法,识别图片二维码(iOS8.0之后使用)

- (void)scanQRCode:(UIImage *)image{
    
    CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:@{ CIDetectorAccuracy : CIDetectorAccuracyHigh }];
    
    NSArray *features = [detector featuresInImage:[CIImage imageWithCGImage:image.CGImage]];
    
    for (int index = 0; index < [features count]; index ++) {
        CIQRCodeFeature *feature = [features objectAtIndex:index];
        NSString *scannedResult = feature.messageString;
        NSLog(@"result:%@",scannedResult);
    }
}

你可能感兴趣的:(iOS自带方法,识别图片二维码(iOS8.0之后使用))