Swift 2,警告:无法从dyld共享缓存中加载任何Objective-C类信息 [英] Swift 2, warning: could not load any Objective-C class information from the dyld shared cache

查看:924
本文介绍了Swift 2,警告:无法从dyld共享缓存中加载任何Objective-C类信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一些关于这个问题的问题,但都没有帮助我的问题。我试图使用这个代码(在Xcode 6和模拟器...中完美地保存对象到核心数据):

I have found a few questions regarding this issue, yet none of them were helping with my problem. I am trying to save an object to core data using this code (which worked perfectly fine in Xcode 6 and Simulator...):

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。
现在,当我点击保存按钮,这段代码被调用,应用程序冻结,我得到以下:

I added the do-try-catch once I started working on this project in the Xcode 7 beta and a physical device. Now, when I hit the Save button, this piece of code is called, the app freezes and I get the following:


warning:无法从dyld共享缓存中加载任何Objective-C类信息。这将显着降低可用类型信息的质量。

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

有人知道我在哪里错了吗?

Does anybody know where I went wrong?

推荐答案

我刚刚遇到了这个问题自己,结果证明,我其实是从递归函数堆栈溢出。

For anyone coming across this in the future, I just ran into this problem myself and it turned out that I was actually getting a stack overflow from a recursive function.

显然调用 setValue:forKey :在 c> 上调用 set [Key] forKey 部分的(大写)名称。

Apparently calling setValue:forKey: on an NSObject calls the respective set[Key] function, where [Key] is the (capitalized) name you gave to the forKey section.

因此,如果和我一样,如下所示,它将导致无限循环和崩溃。

So, if like me, you have code that looks like the following, it will cause an infinite loop and crash.

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

这篇关于Swift 2,警告:无法从dyld共享缓存中加载任何Objective-C类信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆