On 28/04/2010, at 9:18 PM, Jean-Daniel Dupas wrote:

> 
> Le 28 avr. 2010 à 13:09, Graham Cox a écrit :
> 
>> 
>> On 28/04/2010, at 8:00 PM, Gerriet M. Denkmann wrote:
>> 
>>>     //      *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver 
>>> cannot encode structs
>>> 
>>> Using NSArchiver (without the "Keyed") works fine.
>>> 
>>> How am I supposed to save my array of points?
>>> 10.6.3.
>> 
>> 
>> I find the easiest way is to use NSStringFromPoint and NSPointFromString to 
>> store these types.
>> 
> 
> What about :
> 
> - (void)encodeSize:(NSSize)size forKey:(NSString *)key



Well, there is - (void)encodePoint:(NSPoint)point forKey:(NSString *)key, but 
you can only use that from within a call to -encodeWithCoder:. If you have a 
need to archive something from "outside", as in the OP's code, wrapping it in a 
NSValue doesn't work (really, that seems to be an oversight on NSValue's 
compliance with NSCoding), but converting it to a string will work. Same for 
Rects, sizes et. al. I would think it's odds-on that the internals of 
-encodePoint:forKey: just make a call to NSStringFromPoint anyhow.

--Graham




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to