我有这个代码(他使用的是旧的2.3版本的NSDictionary我相信虽然在修复了前1000个转换问题后我感到有些困惑):
var attr_opt: Dictionary? = nil;
do {
attr_opt = try FMainFileManager.aributesOfItem(aPath: APath);
}
catch {
}
Run Code Online (Sandbox Code Playgroud)
Xcode声称错误
nil无法初始化特定的词典?
并建议使用 Dicionary??
谁能解释为什么原始声明不再有效?如有必要,最好的转换方式是什么?
你说这是什么样的字典,也就是指定其键的类型和它的值,例如类型[String:String]?或[String:Any]?或类似.
对应于可空的NSDictionary,最通用的可能类型是[AnyHashable:Any]?.但最好是尽可能具体.
| 归档时间: |
|
| 查看次数: |
32 次 |
| 最近记录: |