NSArchiver
NSArchiver
- Subject: NSArchiver
- From: stuartbryson <email@hidden>
- Date: Sun, 12 Aug 2001 12:28:34 +1000
Hi all,
In my program I create various 3D objects within a Build function. I
want to however save these 3D objects to file so I can just import them
when I run. I thought NSArchiver would do the trick. I started with the
code below:
Object3D *tempObj;
NSArchiver *tempArchive;
tempObj = [[[Sphere alloc] init] autorelease];
[tempObj setRadius:85.0];
[tempObj setColour:[[[RGBVector alloc] initWithValuesRed:1.0
green:0.0 blue:0.0]autorelease]];
[self addThreeDObject:tempObj];
if (![tempArchive archiveRootObject:tempObj
toFile:@"/MyPath/3dObject"]);
NSLog(@"File was not archived");
This does not work however... I am not sure why but the compiler says
that NSArchiver does not respond to archiveRootObject... I checked the
doco and perhaps I do not understand how to use the + methods in each
class. I understand that + methods are class methods and not instance
methods?
Any help on this would be appreciated. Perhaps NSArchiver isn't even the
way to go?
Thanks
Stuart