Ich verwende eine MTBBarcodeScanner
interface, um eine Barcode-Scanner-Anwendung zu implementieren.
Ich brauche das Standbild des Scanners in meinem Code zu bekommen, also versuche ich, um die Funktion aufzurufen:IOS zum Aufrufen der Funktion geben geben Fehler
- (void)captureStillImage:(void (^)(UIImage *image, NSError *error))captureBlock {
if ([self isCapturingStillImage]) {
if (captureBlock) {
NSError *error = [NSError errorWithDomain:kErrorDomain
code:kErrorCodeStillImageCaptureInProgress
userInfo:@{NSLocalizedDescriptionKey : @"Still image capture is already in progress. Check with isCapturingStillImage"}];
captureBlock(nil, error);
}
return;
}
AVCaptureConnection *stillConnection = [self.stillImageOutput connectionWithMediaType:AVMediaTypeVideo];
if (stillConnection == nil) {
if (captureBlock) {
NSError *error = [NSError errorWithDomain:kErrorDomain
code:kErrorCodeSessionIsClosed
userInfo:@{NSLocalizedDescriptionKey : @"AVCaptureConnection is closed"}];
captureBlock(nil, error);
}
return;
}
[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:stillConnection
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (error) {
captureBlock(nil, error);
return;
}
NSData *jpegData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *image = [UIImage imageWithData:jpegData];
if (captureBlock) {
captureBlock(image, nil);
}
}];
}
Aus meiner Viewcontroller ich diese Funktion wie nenne:
UIImage *img;
NSError *e;
[_scanner captureStillImage:img :e];
aber gibt mir den Fehler:
No visible @interface for 'MTBBarcodeScanner' declares the selector 'captureStillImage::
Wie kann ich diese Funktion Unterklasse meiner UIViewcontroller
nennen?