考虑将使用NSDictionary初始化的NSFetchRequest创建为resultType:
let fetchRequest = NSFetchRequest<NSDictionary>(entityName: "Student")我的问题是,为什么我们仍然需要将resultType设置为NSDictionary。使用NSDictionary初始化fetch请求时,为什么不自动设置此字段
fetchRequest.resultType = .dictionaryResultType同样,下面的问题也是一样的:为什么需要第二行:
let fetchRequest = NSFetchRequest<NSNumber>(entityName: "Employee")
fetchRequest.resultType = .countResultType发布于 2019-09-04 23:24:39
核心数据最初是在Objective C中编写的,当时它还没有泛型。
发布于 2019-09-05 22:47:36
用于更高级的查询,如order/group by。示例:https://stackoverflow.com/a/31972710/7715250
https://stackoverflow.com/questions/57791473
复制相似问题