1
我正在將swift swift 2.3轉換爲swift 3.0;Swift 2.3到Swift 3.0獲取模糊引用錯誤給成員'joined'
雨燕2.3代碼:
extension ContextDidSaveNotification: CustomDebugStringConvertible {
public var debugDescription: String {
var components = [notification.name]
components.append(managedObjectContext.description)
for (name, set) in [("inserted", insertedObjects), ("updated", updatedObjects), ("deleted", deletedObjects)] {
let all = set.map { $0.objectID.description }.joinWithSeparator(", ")
components.append("\(name): {\(all)}")
}
return components.joinWithSeparator(" ")
}
}
雨燕3.0代碼:
extension ContextDidSaveNotification: CustomDebugStringConvertible {
public var debugDescription: String {
var components = [notification.name]
components.append(Notification.Name(rawValue: managedObjectContext.description))
for (name, set) in [("inserted", insertedObjects), ("updated", updatedObjects), ("deleted", deletedObjects)] {
let all = set.map { $0.objectID.description }.joined(separator: ", ")
components.append(Notification.Name(rawValue: "\(name): {\(all)}"))
}
return components.joined(separator: " ")
}
}
但我得到的錯誤:不明確的參考memeber '加入()'爲落色回報在Swift 3.0代碼中。
如何解決這個問題?我做了很多研究,但找不到工作解決方案。
感謝
嘗試顯式聲明組件var初始化的類型。 –
'Notification.Name'是Swift 3中的一個結構 - 而不是一個字符串 - 這不是'joined()'所期望的 – vadian