2016-11-10 43 views
0
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上正常工作。「在合理的時間內表達太複雜,無法在合理的時間內解決」,同時將數據添加到快速字典中3,快速正常工作2.3

Swift 3編譯器說打破錶達式的子表達式。

請提出一個合適的解決方案。

+0

替換'和'Any' AnyObject'(以下簡稱「太複雜,要解決」隱藏實際編譯時錯誤:嘗試編譯你的例子如少數成員)。 – dfri

+1

實際上並沒有解決我的問題 –

回答

1

在下面的方式打破它的工作對我罰款

var dictionary = [String: Any]() 
    dictionary["key1"] = value1 
    dictionary["key2"] = value2 
    //... 
相關問題