尝试使用swift中字典中的键填充数组.
var componentArray: [String]
let dict = NSDictionary(contentsOfFile: NSBundle.mainBundle().pathForResource("Components", ofType: "plist")!)
componentArray = dict.allKeys
Run Code Online (Sandbox Code Playgroud)
这将返回以下错误:'AnyObject'与string不同
也试过了
componentArray = dict.allKeys as String
Run Code Online (Sandbox Code Playgroud)
但得到:'String'不能转换为[String]