title: iOS 7 AVCaptureMetadataOutput delegate (QRCode scanner)
body: <p>I'm trying to implement a QRCode scanner with the new iOS 7 features but my code isn't calling the main <code>AVCaptureMetadataOutputObjectsDelegate</code> method.</p>
  
  <p>I've used the AVFoundation camera before and with my current implementation I've got the preview layer running without a problem. Even switching my output back to <code>AVCaptureVideoDataOutput</code> validates my session setup.</p>
  
  <p>I'm using this <a href="http://nshipster.com/ios7/">NSHipster post</a> as a guideline and here's my code so far:</p>
  
  <p><strong>Interface:</strong></p>
  
  <pre><code>@import AVFoundation;
  
  @interface QRCodeViewController () &lt;AVCaptureMetadataOutputObjectsDelegate&gt;
  
  @property (strong, nonatomic) AVCaptureDevice* device;
  @property (strong, nonatomic) AVCaptureDeviceInput* input;
  @property (strong, nonatomic) AVCaptureMetadataOutput* output;
  @property (strong, nonatomic) AVCaptureSession* session;
  @property (strong, nonatomic) AVCaptureVideoPreviewLayer* preview;
  
  @end
  </code></pre>
  
  <p><strong>Setup:</strong></p>
  
  <pre><code>- (void)setupCamera
  {
      // Device
      self.device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
  
      // Input
      self.input = [AVCaptureDeviceInput deviceInputWithDevice:self.device error:nil];
  
      // Output
      self.output = [[AVCaptureMetadataOutput alloc] init];
      [self.output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
  
      // Session
      self.session = [[AVCaptureSession alloc] init];
      [self.session addInput:self.input];
      [self.session addOutput:self.output];
  
      // Preview
      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);
      [self.view.layer insertSublayer:self.preview atIndex:0];
  
      // Start
      [self.session startRunning];
  }
  </code></pre>
  
  <p><strong>Delegate Method:</strong></p>
  
  <pre><code>// DELEGATE METHOD NOT CALLED
  - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection
  {
      NSLog(@"Metadata");
  }
  </code></pre>
  
  <p>Any help is greatly appreciated!</p>