xcode - swift 2,警告: could not load any Objective-C class information from the dyld shared cache

标签 xcode core-data console swift2 xcode7

我发现了一些有关此问题的问题,但没有一个能帮助解决我的问题。我正在尝试使用此代码将对象保存到核心数据(在 Xcode 6 和模拟器中运行得很好...):

let fetchRequest = NSFetchRequest(entityName: "Patient")
let fetchedResults : [NSManagedObject]!
do {
    fetchedResults = try managedContext.executeFetchRequest(fetchRequest) as! [NSManagedObject]
    patienten = fetchedResults
}    catch {
    print("error")
}

当我开始在 Xcode 7 beta 和物理设备中处理这个项目时,我添加了 do-try-catch。 现在,当我点击“保存”按钮时,将调用这段代码,应用程序卡住,并得到以下信息:

warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.

Screenshot

有人知道我错在哪里吗?

最佳答案

对于将来遇到这个问题的人,我自己也遇到了这个问题,结果发现我实际上是从递归函数中得到了堆栈溢出。

显然,在 NSObject 上调用 setValue:forKey: 会调用相应的 set[Key] 函数,其中 [Key] 是(大写) ) 您为 forKey 部分指定的名称。

因此,如果像我一样,您的代码如下所示,它将导致无限循环并崩溃。

func setName(name: String) {
    self.setValue(name, forKey: "name")
}

关于xcode - swift 2,警告: could not load any Objective-C class information from the dyld shared cache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31431287/

相关文章:

python - 停止 Python 模块打印

xcode - 每当我运行时,由于IBOutletCollection,XCode都会引发Sigabrt错误

iphone - 如何释放 subview

ios - 核心数据关系之谜

ios - RestKit,问题和标签之间的多对多关系,如 Stackoverflow api

c# - API 函数 AllocConsole 和 AttachConsole(-1) 之间有什么不同?

c# - 检查字符串是否不等于某物

ios - AWS Pod 库的迁移

ios - xcode模拟器iphone屏幕尺寸

ios - 检查核心数据实体的属性是否为空?