文章目录
- 如下图会报错:
- 点击Fix后还是会报错:
- 解决方法:在Key和Value的位置写上具体的数据类型
- 参考博客:
如下图会报错:
- Cannot convert value of type ‘Any’ to specified type ‘Dictionary<Key, Value>’
Insert ’ as! Dictionary<Key, Value>’- Generic parameter ‘Key’ could not be inferred
- Generic parameter ‘Value’ could not be inferred
点击Fix后还是会报错:
- Cannot find type ‘Key’ in scope
解决方法:在Key和Value的位置写上具体的数据类型
let dict : Dictionary = any as! Dictionary<String, Any>
参考博客:
将AnyObject以swift格式转换为Dictionary
更多推荐
swift Any转字典Dictionary Cannot convert value of type ‘Any‘ to specified type ‘Dic
发布评论