这是他们的示例功能
[GTMagBarDevice sharedDevice].delegate = self;
我尝试像这样快速重写它
GTMagBarDevice.sharedDevice().delegate = self;
但是我收到错误"类型视图控制器不符合协议GTMagBarDeviceDelegate"
有什么想法吗?
更新
我已经实现了所有必需的功能,这就是它在我正在桥接的.h文件中所说的
@protocol GTMagBarDeviceDelegate <NSObject>
@required
- (void)magbarDevice:(GTMagBarDevice*)device accessoryConnected:(BOOL)state;
- (void)magbarDevice:(GTMagBarDevice*)device componentFailed:(int)components;
这就是植入
func magbarDevice(magbarDevice: GTMagBarDevice, accessoryConnected isAccessoryConnected: Bool) {
}
func magbarDevice(magbarDevice: GTMagBarDevice, componentFailed components: Int) {
}
答案 0 :(得分:1)
您需要实现您所遵循的协议所需的方法。
答案 1 :(得分:0)
看起来您的功能签名不正确。请尝试这些:
func magbarDevice(device: GTMagBarDevice!, accessoryConnected state: Bool) {
}
func magbarDevice(device: GTMagBarDevice!, componentFailed components: Int32) {
}