例如我只想這個樣本數組轉換成JSON對象使用未解決的標識符「JSONEncoder」 swift4
var test = [String : Any]()
test["title"] = "title"
test["description"] = "description"
test["date"] = Date.init()
,我得到這個錯誤:
use of unresolved identifier 'JSONEncoder'
print(JSONEncoder (test))
您是否進口基金會?你確定你正在運行Swift 4嗎?什麼是「swift -version」輸出? – Hamish