• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArchiver & NSUnarchiver (noob)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArchiver & NSUnarchiver (noob)


  • Subject: Re: NSArchiver & NSUnarchiver (noob)
  • From: Aaron Boothello <email@hidden>
  • Date: Sun, 7 Jan 2007 21:02:44 +0800

A slight correction to the code posted earlier:


here's what im using to write the data out to a file(in the controller class):



BOOL ret; ret = [NSArchiver archiveRootObject:myModel toFile:path];

Where path is predefined for now.

here's what  the loading looks like (n the controller class again):


myModel = [[NSUnarchiver unarchiveObjectWithFile:path] retain];

myModel is defined in the controller and views as:

IBOutlet mainModel *myModel;


On 07/01/2007, at 5:33 PM, Aaron Boothello wrote:

Ive gotten to the point where i want to save data from my application out to a file. ive done a little with NSArchiver and NSUnarchiver before and it worked just fine.

Ive changed the design of my project and have adopted the MVC paradigm. So...

In IB:
-i have a controller class initialized
-i also have my model class in the IB and have my controllers and views all linked to that icon in IB (im assuming that's an instance of my model).


My model compromises of 3-4 different classes, all of which comply with NSCoding protocol.

here's what im using to write the data out to a file(in the controller class):


BOOL ret; ret = [NSArchiver archiveRootObject:mySuperModel toFile:path];

Where path is predefined for now.

here's what  the loading looks like (n the controller class again):


myModel = [[NSUnarchiver unarchiveObjectWithFile:path] retain];

myModel is defined in the controller and views as:

IBOutlet mainModel *myModel;

So ive been debugging the unarchiving, and i can see that the data is loaded... somewhere. i cant figure out where. My question is, does unarchiver allocate another section of memory to load the file into ? and returns that address ? and is that why my NSViews cant seem to see that a file has been loaded ? how do i do this more efficiently ? is there a better/simpler way ?

Thanks,
Aaron Boothello
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >NSArchiver & NSUnarchiver (noob) (From: Aaron Boothello <email@hidden>)

  • Prev by Date: Re: regarding transparent NSWindow.
  • Next by Date: Re: previousResponder?
  • Previous by thread: NSArchiver & NSUnarchiver (noob)
  • Next by thread: Integrate CM into Cocoa
  • Index(es):
    • Date
    • Thread