- + (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];
- }
来源: http://www.phpxs.com/code/1006624/