0
我正在研究一個簡單的iOS Swift應用程序,並且找不到任何有關核心數據小問題的解決方案。我必須將我從核心數據中提取的一些數據分組,但它不起作用。Swift核心數據 - 組無法工作
這是我fetchRequest:
<NSFetchRequest: 0x7f82fbe105e0> (entity: Sets; predicate: ((null)); sortDescriptors: ((
"(sort, ascending, compare:)"
)); type: NSDictionaryResultType; includesPendingChanges: NO; propertiesToFetch: ((
name
)); propertiesToGroupBy: ((
name
));)
我已經排序並添加屬性組。還設置了一個結果類型 - DictionaryResultType。
這裏是我的FetchRequest:
fetchRequest = NSFetchRequest(entityName:entity)
fetchRequest.propertiesToGroupBy = groupDescriptors
fetchRequest.propertiesToFetch = propertiesToFetch
fetchRequest.resultType = .DictionaryResultType
let fetchedResults = managedContext.executeFetchRequest(fetchRequest as NSFetchRequest, error: &error) as? [NSManagedObject]
- 實體是一個字符串variabel
- groupDescriptors和propertiesToFetch都是String