我有一个用Swift编写的类,我已经定义了一个协议:
protocol PhotoIngestionDelegate {
func pictureTaken()
}
我正在尝试使用Objective-C编写的类(CameraViewController)符合此协议。
CameraViewController.h:
#import <GSSDK/GSSDK.h>
@protocol PhotoIngestionDelegate;
@interface CameraViewController : GSKCameraViewController <PhotoIngestionDelegate>
@end
CameraViewController.m:
#import "CameraViewController.h"
#import <GSSDK/GSSDK.h>
#import "EditFrameViewController.h"
#import "Scan.h"
@interface CameraViewController<PhotoIngestionDelegate> ()
@property (nonatomic, strong) UIView *toolbar;
@property (nonatomic, strong) UIButton *cameraButton;
@end
@implementation CameraViewController
...
CameraViewController.m中的实现仍在继续,但我将其剪掉以保持简洁。我知道我需要在CameraViewController.m中定义函数pictureTaken(),但我似乎无法让委托连接工作。在CameraViewController.h中我得到它Cannot find protocol definition for 'PhotoIngestionDelegate'
。
答案 0 :(得分:0)
试试这个
@objc protocol PhotoIngestionDelegate {
}