我正在尝试使用SwiftyJSON创建一个JSON字典:
let addressAttributes: JSON = [
"latitude": address.latitudeFloat,
"longitude": address.longitudeFloat,
"street_1": address.street1,
"street_2": address.street2,
"city": address.city,
"state_code": address.stateCode,
"zip_code": address.zipCode
]
不幸的是,我收到type of expression is ambiguous without more context
的警告。我在这里有String?
和Float?
个选项。
我错过了什么?
如果我从字典中删除Float?
值,则会获得Cannot convert value of type '[String: String?]' to specified type 'JSON'
。