Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As with the release of <code>iOS7</code> you no longer need to use an external framework or library. <strong>The iOS ecosystem with AVFoundation now fully supports scanning</strong> almost every code from QR over EAN to UPC.</p> <p>Just have a look at the <a href="https://developer.apple.com/library/ios/technotes/tn2325/_index.html">Tech Note</a> and the <a href="https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html">AVFoundation programming guide</a>. <a href="https://developer.apple.com/library/IOS/documentation/AVFoundation/Reference/AVMetadataMachineReadableCodeObject_Class/index.html#//apple_ref/doc/constant_group/Machine_Readable_Object_Types"><code>AVMetadataObjectTypeQRCode</code></a> is your friend.</p> <p>Here is a nice <strong>tutorial</strong> which shows it step by step: <a href="http://www.ama-dev.com/iphone-qr-code-library-ios-7/">iPhone QR code scan library iOS7</a></p> <p>Just a little example on how to set it up:</p> <pre><code>#pragma mark - #pragma mark AVFoundationScanSetup - (void) setupScanner { self.device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; self.input = [AVCaptureDeviceInput deviceInputWithDevice:self.device error:nil]; self.session = [[AVCaptureSession alloc] init]; self.output = [[AVCaptureMetadataOutput alloc] init]; [self.session addOutput:self.output]; [self.session addInput:self.input]; [self.output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()]; self.output.metadataObjectTypes = @[AVMetadataObjectTypeQRCode]; self.preview = [AVCaptureVideoPreviewLayer layerWithSession:self.session]; self.preview.videoGravity = AVLayerVideoGravityResizeAspectFill; self.preview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); AVCaptureConnection *con = self.preview.connection; con.videoOrientation = AVCaptureVideoOrientationLandscapeLeft; [self.view.layer insertSublayer:self.preview atIndex:0]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload