Gustl007
Gustl007

Reputation: 245

Refactor-renaming of class causes termination

I renamed a class with the refactor function, but now the app crashes with an error

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason:   '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class

When i keep the old name everything works fine. So i assume XCode did not change all of the old names so now there is an unchanged piece of code somewhere in my project, that causes the termination, but i cannot find it! I looked especially around the NSKeyedUnarchiever function where the error according to xcode appeared, but i am not able to locate it.

So do you guys have ideas what might be the problem? Or is it just so that i have to look more?

Thanks in advance!

Upvotes: 0

Views: 220

Answers (1)

Wain
Wain

Reputation: 119031

If you have changed the name of a class in an archive you need to teach the unarchiver how to deal with that (it isn't magic). Use setClass:forClassName: to set the new class for the old class name.

Upvotes: 2

Related Questions