IOS原生API,二维码扫描(https://github.com/reesun1130/SYQRCodeDemo)

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

+ (BOOL)isAVCaptureActive
{
  AVCaptureDevice *aDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

  NSError *inputError = nil;
  AVCaptureDeviceInput *aInput = [AVCaptureDeviceInput deviceInputWithDevice:aDevice error:&inputError];

  if (aInput == nil)
  {
      SYLog(@"init AVCapture fail--%@",inputError);

      return NO;
  }

  return YES;
}

if(isAVCaptureActive)
{
   SYQRCodeViewController *syqrc = [[SYQRCodeViewController alloc] init];
   syqrc.SYQRCodeSuncessBlock = ^(NSString *qrString){
     self.saomiaoLabel.text = qrString;
   };

   syqrc.SYQRCodeCancleBlock = ^(SYQRCodeViewController *aqrc){
     self.saomiaoLabel.text = @"扫描取消~";
     [aqrc dismissViewControllerAnimated:YES completion:nil];
   };
   [self presentViewController:syqrc animated:YES completion:nil];
}