Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Olbert000

macrumors newbie
Original poster
Feb 7, 2011
8
0
I am attempting to archive my class OCFrame which has two members, using NSKeyedArchiver.

@interface OCFrame : NSObject <NSCopying> {
CMAcceleration acc;
CMRotationRate rot;
}

I tried using both:

[coder encodeObject:rot forKey:mad:"rot"];

and:

[coder encodeValueOfObjCType:mad:encode(CMAcceleration) at:&acc];

and their corrasponding decode functions. It seems that NSKeyedArchiver cannot deal with structs.

How do I archive these?
 

hayesk

macrumors 65816
May 20, 2003
1,459
101
You can only archive objects. I think you can put the structs into a dictionary using encodeFloat:forKey encodeInt:forKey, etc. on the components of your structs. Or write them to an NSData object.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.