NSKeyedUnarchiver error after renaming Xcode project for OSX

后端 未结 3 1504
面向向阳花
面向向阳花 2021-01-14 22:58

I am having issues with (I think) the namespace after changing the project name. Here is the error:

Terminating app due to uncaught exception \'NSInva

3条回答
  •  情话喂你
    2021-01-14 23:50

    I sort of gave up on this and continued to go with my decision to rename the project.

    So in init() of my class which contains all the methods for handling data from CoreData, I placed the following code:

    class CoreDataHelper {
        init() {
            NSKeyedUnarchiver.setClass(SpecialTextAttachment.self, forClassName: "Apple.SpecialTextAttachment")
        }
    }
    

    This will convert any Apple.SpecialTextAttachment to Pear.SpecialTextAttachment in any upcoming operations in which SpecialTextAttachment may come up.

提交回复
热议问题