【发布时间】:2018-12-19 23:11:55
【问题描述】:
有以下代码块:
do {
try call.receiveMessage { callResult in
if let msg = try callResult.resultData {
let result = try decoder.decode(valueType, from: msg)
}
// other stuff
} catch let error {
if let callback = self.onError {
callback(error)
}
}
由于try call.receieveMessage 的错误导致编译失败:
从 '(_) throws -> ()' 类型的抛出函数到非抛出函数类型 '(CallResult) -> Void' 的无效转换
我调用的函数确实有签名改变:
from: public func receiveMessage(completion: @escaping (Data?) throws -> Void) throws { to: public func receiveMessage(completion: @escaping (CallResult) -> Void) throws {
让我难以理解的是同一方法的其他调用没有问题,所以我还没有完全确定是什么让这个特定的块特别。
任何建议将不胜感激。
【问题讨论】:
标签: swift