Swift 2, warning: could not load any Objective-C class information from the dyld shared cache

后端 未结 5 1484
青春惊慌失措
青春惊慌失措 2021-02-04 23:43

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 perfec

5条回答
  •  日久生厌
    2021-02-05 00:02

    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.

    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")
    }
    

提交回复
热议问题