使用 Dictionary 时,方法不能是 @objc 协议的成员

Method cannot be a member of an @objc protocol while using Dictionary

我正在 swift 编码。我写了协议

@objc protocol ServerDelegate {
    optional func onDownloadDataComplete (downloadedData data : [Dictionary<String,Any>],result : ResultType,error : String)
}

首先,我的枚举收到了 "Method cannot be a member of an @objc protocol because the type of the parameter 2 cannot be represented in Objective-C",但我通过添加 @objc 修复了它。现在我收到这个字典数组。如何解决?

正如@originaluser2 所说 Any 不能在 @objc 中表示所以我创建了一个新的 class,添加了我需要的数据成员,用 NSObject 继承了它并且返回它的数组而不是字典,现在一切都很好。