• 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: Saving data to a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving data to a file


  • Subject: Re: Saving data to a file
  • From: Ron Phillips <email@hidden>
  • Date: Fri, 14 Mar 2003 17:37:07 -0600

Jonathan,
Thanks for the quick reply. I am (was) using Bill's book as a guide but when I got to "dataRepresentationOfType:" for saving the data, it appeared to be a dead end since that method is from NSDocument which I don't support. This is part of the confusion. Do I just substitute writeToFile:atomically: and I'm done? I don't think that agrees with Chris' comment.

Regards,
Ron


On Friday, March 14, 2003, at 04:19 PM, Jonathan E. Jackel wrote:

You are talking about archiving, which deals with the NSCoder subclasses
NSArchiver, NSUnarchiver, NSKeyedArchiver and NSKeyedUnarchiver. Here is a
very good explanation of both "classic" and keyed archiving:

http://www.stepwise.com/Articles/VermontRecipes/KeyedArchiving.html

Just follow the example. You'll have to wrap your ints, BOOLs and other
scalars in objects like NSNumber or NSData, but other than that, it's pretty
straightforward.

Jonathan


-----Original Message-----
From: email@hidden
[mailto:email@hidden]On Behalf Of Ron Phillips
Sent: Friday, March 14, 2003 4:48 PM
To: email@hidden
Subject: Saving data to a file


I have scoured the cocoa-dev archives, web sites and books and still am
confused on how best to write data to a file from a non-document-based
application. An XML format is fine, human-readable is not required. I
have a collection of arrays, ints, strings, and BOOLs. What
preparation is needed for a property list? Chris Kane indicated that
archiving is not compatible with plists and writeToFile:atomically:.
That's cool, so do I just *somehow* wrap up my high-level object into
an NSData object and do the write? If so, what's the best approach to
do that? Is encoding still needed?

Thanks in advance and best regards,
Ron
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >RE: Saving data to a file (From: "Jonathan E. Jackel" <email@hidden>)

  • Prev by Date: Sheet vs Window updating
  • Next by Date: Re: Synchronize timer with internal clock
  • Previous by thread: RE: Saving data to a file
  • Next by thread: Re: Saving data to a file
  • Index(es):
    • Date
    • Thread