3
生成錯誤我收到如下:xcode的說法無法找到ZBarSDK.h,但它是在我的項目
詞彙或預處理問題「ZBarSDK.h」未找到文件
我在我的項目下看到它,我需要做什麼才能讓構建找到它?
我試過把它拖到我的主項目文件夾中。
生成錯誤我收到如下:xcode的說法無法找到ZBarSDK.h,但它是在我的項目
詞彙或預處理問題「ZBarSDK.h」未找到文件
我在我的項目下看到它,我需要做什麼才能讓構建找到它?
我試過把它拖到我的主項目文件夾中。
忘記ZBarSDk這已經列入AVFoundation框架工作 使用本
試試這個在iOS 7及更高版本
捕獲QR代碼:
- (IBAction)Capture:(id)sender {
isFirst=true;
_session = [[AVCaptureSession alloc] init];
_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
_input = [AVCaptureDeviceInput deviceInputWithDevice:_device error:&error];
if (_input) {
[_session addInput:_input];
} else {
NSLog(@"Error: %@", error);
}
_output = [[AVCaptureMetadataOutput alloc] init];
[_output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
[_session addOutput:_output];
_output.metadataObjectTypes = [_output availableMetadataObjectTypes];
_prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session];
_prevLayer.frame = self.view.bounds;
_prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[self.view.layer addSublayer:_prevLayer];
[_session startRunning];
}
要閱讀使用其委託梅索德:
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection
{
CGRect highlightViewRect = CGRectZero;
AVMetadataMachineReadableCodeObject *barCodeObject;
NSString *detectionString = nil;
NSArray *barCodeTypes = @[AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code,
AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeCode128Code,
AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeAztecCode];
for (AVMetadataObject *metadata in metadataObjects) {
for (NSString *type in barCodeTypes) {
if ([metadata.type isEqualToString:type])
{
barCodeObject = (AVMetadataMachineReadableCodeObject *)[_prevLayer transformedMetadataObjectForMetadataObject:(AVMetadataMachineReadableCodeObject *)metadata];
highlightViewRect = barCodeObject.bounds;
detectionString = [(AVMetadataMachineReadableCodeObject *)metadata stringValue];
break;
}
}
if (detectionString != nil)
{
if (isFirst) {
isFirst=false;
_label.text = detectionString;
break;
}
}
else
_label.text = @"(none)";
}
_highlightView.frame = highlightViewRect;
}
您是否檢查過所有文件是否已導入到您的項目? – Rajesh
請檢查下面的答案 http://stackoverflow.com/questions/25903432/how-fix-error-xcode-lexical-preprocessor-issue-cordova-cdvjpegheaderwriter-hf – Rajesh
確保你給路徑靶>建立設置 - >框架搜索路徑。 – sschunara