Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS-无法强制转换NSKnownKeyDictionary1类型的值_Ios_Swift_Core Data_Nspredicate_Nsfetchrequest - Fatal编程技术网

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'