Archiving CMAcceleration and CMRotationRate

Discussion in 'iOS Programming' started by Olbert000, Feb 15, 2011.

  1. Olbert000 macrumors newbie

    Feb 7, 2011
    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"];


    [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?
  2. hayesk macrumors 65816

    May 20, 2003
    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.

Share This Page