objective-c - 与父类(super class)属性名称和协议(protocol)方法名称冲突

标签 objective-c swift

我正在使用 GPUImage ( https://github.com/BradLarson/GPUImage ),并希望实现一个继承基类 GPUImageOutput 的类并实现 GPUImageInput 协议(protocol)。

得到错误: 具有 Objective-C 选择器“shouldIgnoreUpdatesToThisTarget”的方法“shouldIgnoreUpdatesToThisTarget()”与具有相同 Objective-C 选择器的父类(super class)“GPUImageOutput”中“shouldIgnoreUpdatesToThisTarget”的 getter 冲突

Swift 中有解决此问题的方法吗?

我唯一的解决方案是: 实现 Obj-C“虚拟基类”并在 Swift 中继承它们?!

最佳答案

尝试使用不同的 getter 从基类重新声明属性:

@property(readwrite, nonatomic, getter=superclass_shouldIgnoreUpdatesToThisTarget) BOOL shouldIgnoreUpdatesToThisTarget;

关于objective-c - 与父类(super class)属性名称和协议(protocol)方法名称冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36628206/

相关文章:

ios - 如何在 swift 中定义自定义本地化常量

iphone - 阻止 iCloud 备份

objective-c - isValidJSONObject 未按预期工作

objective-c - ios中的GDataXMLElement到原始xml字符串

swift - ARKit 将 WorldTrackingConfiguration 设置为 gravityAndHeading 会产生错误

ios - 访问其他 ViewController Swift 3 中的变量

ios - UITextfield 委托(delegate)响应所有文本字段

iphone - 在 xcode 4.2 上播放时没有背景音乐

objective-c - 每个核心数据关系都必须有一个逆关系吗?

xcode - 在 Swift 中动态分配类型