【发布时间】:2014-06-26 21:06:05
【问题描述】:
在以下代码中,我使用 CoreData 来获得不同的结果:
request.propertiesToFetch = NSArray(objects: "docID", "docName")
request.resultType = NSFetchRequestResultType.DictionaryResultType
request.returnsDistinctResults = true
var distinctResults: NSArray = context.executeFetchRequest(request, error: nil)
println(distinctResults)
这是 println() 的输出:
( { 文档ID = 3; docName = "高伊博士"; }, { 文档ID = 1; docName = "巴博士"; }, { 文档ID = 0; docName = "符博士"; }, { 文档 ID = 2; docName = "巴兹先生"; } )
这是一个带有字典的数组 - 我如何将这个 NSArray 转换为带有 for 循环的字典
感谢您的帮助!
【问题讨论】:
-
您希望字典采用什么格式?
-
对不起 - 我想转换成 Dictionary
标签: objective-c xcode core-data swift