2
將我的代碼庫更新到Swift 3.0,我無法弄清楚如何解決我在遷移時生成的錯誤:「Contextual type'AnyObject'can not與字典文字一起使用「。任何幫助將不勝感激。更新到Swift 3.0:上下文類型'AnyObject'不能與字典文字一起使用
typealias JSONDictionary = Dictionary<String, AnyObject>
func infoDict() -> JSONDictionary {
return ["users" :
//the following line generates the error "Contextual type 'AnyObject' cannot be used with dictionary literal"
["add" : Array(self.addUserIDs), "del" : Array(self.removeUserIDs)],
"groups" :
["add" : Array(self.addCircleIDs), "del" : Array(self.removeCircleIDs)],
"friends" : friends,
"type" : 1
]
}