【发布时间】:2014-12-09 14:05:46
【问题描述】:
我有一个 Printable 对象数组,但我需要它们符合 Equatable 和 AnyObject 标准。
private(set) var items: [Printable] = []
class func withItems<T: AnyObject where T: Equatable, T: Printable>(items: [T], selectedItem: T? = nil) {
... instance init ...
instance.items = items
}
它会导致 EXC_BAD_INSTRUCTION:
致命错误:无法从 Objective-C 桥接数组
这是解决这个问题的一个尝试:
为什么?
【问题讨论】:
-
您在
class func使用self的目的是什么? -
我刚刚编辑了问题,谢谢
标签: ios swift protocols exc-bad-instruction