Re: I've Got Those NSKeyedUnarchiver Blues!
Re: I've Got Those NSKeyedUnarchiver Blues!
- Subject: Re: I've Got Those NSKeyedUnarchiver Blues!
- From: Stuart Rogers <email@hidden>
- Date: Mon, 05 Dec 2011 09:44:18 +0000
On 4 Dec 2011, at 23:09, Jens Alfke wrote:
>
>> *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (SplitsTestSet)
>>
>> I really don't understand why this is happening. I'm convinced it's
>> not a problem with library linking, as these apps have no problem
>> instantiating various objects sourced from the library. (Almost all
>> my Googling about this exception seem to be down to bad linking.)
>
> My suspicion is that the class SplitsTestSet is getting dead-stripped from the Trainer app. Try adding the line “[SplitsTestSet class]” somewhere in the code, just to force a reference to the class-name so it won’t get stripped.
This worked once I did the same for one of the four other library
classes that SplitsTestSet used.
As my projects use all the classes the library provides, I'll stick to
the -ObjC linker flag solution; adding code to solve what seems to
be a problem with over-enthusiastic link optimisation is anathema
to me. However, this solution would definitely be worth using if I
was using only a tiny fraction of a large library.
> Also try looking at the binary using the ‘nm’ tool to check whether the class symbols exist in the app.
Yes, this made it crystal clear - thanks for pointing me at 'nm' and
helping me understand the solutions.
Stuart
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden