Re: Problems using -writeToFile:atomically: from a NSMutableArray
Re: Problems using -writeToFile:atomically: from a NSMutableArray
- Subject: Re: Problems using -writeToFile:atomically: from a NSMutableArray
- From: Scott Stevenson <email@hidden>
- Date: Mon, 25 Oct 2004 13:22:52 -0700
On Oct 25, 2004, at 1:03 AM, George Lawrence Storm wrote:
Is there a call I can override in this NSObject (Controller) to return
a basic Foundation object (in this case an integer) when saving the
dictionary it is part of as an XML, or do I have to create my own
archiving mechanism?
The easiest approach is to create a method or function that takes your
"normal" array and spits out an array that contains only basic
Foundation objects. The method would traverse the structure to the
point where your custom objects reside, and then replace them with
NSNumbers or whatever. You might want to just create an
NSValueTransformer.
Then, just store that array on disk with writeToFile.
Although this program is only being used to save an XML, for future
reference I probably should ask can it also be converted to read from
the XML as well?
It depends on what you mean by "read from XML." If you mean read from
other XML-formatted Apple property lists, then you can already do that
with NSArray's initWithContentsOfFile. If you mean various other
formats of XML, it's a very broad area and you'd have to provide some
specifics.
Best Regards,
- Scott
--
http://treehouseideas.com/
http://theobroma.treehouseideas.com/ [blog]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden