IOS-无法强制转换NSKnownKeyDictionary1类型的值
我需要IOS-无法强制转换NSKnownKeyDictionary1类型的值,ios,swift,core-data,nspredicate,nsfetchrequest,Ios,Swift,Core Data,Nspredicate,Nsfetchrequest,我需要区分一个字段如下: func fetchListLanguagesContentDegreesPage(catId: Int64, locale: String, completionHandler: @escaping (() throws -> [Degrees]) -> Void) { privat
区分
一个字段
如下:
func fetchListLanguagesContentDegreesPage(catId: Int64,
locale: String,
completionHandler: @escaping (() throws -> [Degrees]) -> Void) {
privateManagedObjectContext.perform {
do {
let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "Degrees")
let query = NSPredicate(format: "(%K = %@) AND (%K = %@)",
"locale",locale,
"parentID",String(catId))
fetchRequest.predicate = query
fetchRequest.resultType = NSFetchRequestResultType.dictionaryResultType
fetchRequest.propertiesToFetch = ["langName"]
fetchRequest.returnsDistinctResults = true
let results = try self.privateManagedObjectContext.fetch(fetchRequest) as! [Degrees]
completionHandler{return results}
} catch {
completionHandler { throw DegreesStoreError.CannotFetch("Cannot fetch orders") }
}
}
}
我能做什么?我如何才能转换NSKnownKeyDictionary1
Could not cast value of type 'NSKnownKeysDictionary1' to 'PortalAlmostafaApp.Degrees'