ios - Swift 1.2 -> NSSet -> 不兼容的类型

标签 ios swift

<分区>

好的,Swift 1.2 发生了什么?我最近更新了,突然我的项目全是红色的。与 NSSet 的兼容性是否已被删除或什么?我该如何解决这个问题?

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {

结果:

Overriding method with selector 'touchesBegan:withEvent:' has incompatible type '(NSSet, UIEvent) -> ()'

最佳答案

请注意,NNsets 现在被声明为:

 func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent)

请尝试下面的代码覆盖

  override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {

        // ...
    }

关于ios - Swift 1.2 -> NSSet -> 不兼容的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29665325/

相关文章:

ios - 应用内购买实时产品出现错误,如 : Cannot connect to iTunes Store

swift - 如何在声明的同一类中的不同方法中使用委托(delegate)检索的变量

ios - 你如何在 Swift/iOS 的 UI 测试中遍历元素?

iphone - 特定月份和年份的 NSFetchRequest

iphone - ios 检查互联网连接后台进程

ios - 使用 NSCoder 解码时崩溃

swift - 从字符串中按位置删除字符

ios - 归档/取消归档时对象是否被修改?

ios - swift 中的 3d 范围问题数组

swift_class_getInstanceExtents 没有出现在 XCode 中——你怎么调用它?