【发布时间】:2019-01-27 19:51:17
【问题描述】:
我有一个 Objective-C 项目,我在其中使用 Swift 脚本和 Obj-C 脚本。
在其中一个 Swift 脚本中,我有一个类:
@objc public class VideoCapture: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate {
~~bunch of functions~~
}
因为它是一个 Obj-C 项目,所以我在它前面加上了@obj,以便它们出现在我的 ($project_name-Swift.h) 头文件中。
我的头文件中写入的内容出现错误:
// sn-p 来自头文件:project_name-Swift.h
#import <AVFoundation/AVFoundation.h>. <— I added this to make sure that AVFoundation is present in the header file
SWIFT_CLASS("_TtC17FLIROneSDKExample12VideoCapture")
@interface VideoCapture : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate> <<——!!! error: No type or protocol named 'AVCaptureVideoDataOutputSampleBufferDelegate'
- (void)captureOutput:(AVCaptureOutput * _Nonnull)output didOutputSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer fromConnection:(AVCaptureConnection * _Nonnull)connection;
- (void)captureOutput:(AVCaptureOutput * _Nonnull)output didDropSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer fromConnection:(AVCaptureConnection * _Nonnull)connection;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
我不明白是什么原因造成的,我猜这与无法从头文件正确访问 AVFoundation 库或其他原因有关。
有解决这个问题的想法吗?
【问题讨论】:
标签: ios objective-c swift xcode avfoundation