let parameters : [String : AnyObject] = [
"address" : txtAddress.text ?? "",
"person_name" : txtAuthorName.text ?? "",
"person_image" : imgUrl ?? "",
"book_title" : txtBookTitle.text ?? "",
"dedicated_to" : txtDedicatedTo.text ?? "" ,
"person_about" : txtAboutTheAuthor.text ?? "",
"is_published" : false,
"recipes" : recipeArr ?? ""]
这是向字典添加数据的代码。在 Swift2.3 上运行良好。
Swift 3 编译器表示将表达式分解为子表达式。
请提出一个合适的解决方案。
最佳答案
以下面的方式打破它对我来说效果很好
var dictionary = [String: Any]()
dictionary["key1"] = value1
dictionary["key2"] = value2
//...
关于ios - "Expression was too complex to be solved in reasonable time"在 swift 3 中向字典添加数据时,在 swift 2.3 中工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40526914/