Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Going from vendoring -> frameworks gives "cannot decode object of class" #34

Open
nickoneill opened this issue Sep 10, 2015 · 3 comments

Comments

@nickoneill
Copy link

For whatever reason (probably Swift 2) I had originally included just the source files of AwesomeCache and I have a bunch of cache files created.

When I reworked some of my project files, I moved AwesomeCache to build as a framework. Now I get "cannot decode object of class" crashes from NSKeyedArchiver because the identifiers have moved from [projectid].CacheObject to AwesomeCache.CacheObject.

I can just use the source files so not a huge deal for me, but I'm wondering if AwesomeCache can do anything to prevent this? Not attempting to decode objects with incorrect IDs would be a minimal fix, but being able to detect and use the alternate IDs is optimal.

@aschuch
Copy link
Owner

aschuch commented Sep 27, 2015

Do you think this would be sufficient to fix your issue?

// before archive
NSKeyedArchiver.setClassName("CacheObject", forClass: CacheObject.self)

// before unarchive
NSKeyedUnarchiver.setClass(CacheObject.self, forClassName: "CacheObject")

@nickoneill
Copy link
Author

No clue, I'm not an expert on NSKeyedArchiver. I was hoping you knew more about the internals.

@aschuch
Copy link
Owner

aschuch commented Sep 28, 2015

Unfortunately, I am not an expert on this either. I guess this change would fix it, but also I don't see a way to effectively test this hypothesis. Do you still have a setup that makes it possible to test this possible fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants