FROM : Christiaan Hofman
DATE : Wed Mar 26 19:03:13 2008
On 26 Mar 2008, at 5:07 PM, <email_removed> wrote:
>
> Dear All,
>
> I tried to use a NSDictionary to save data from my application to a
> plist. It includes a key, and for each key an object (in my case a
> NSArray), works fine !!!
> Now i tried to go one step further for what I need to accomplish,
> instead of saving 2 levels (the key and the corresponding object) I
> want to save 3 levels (Key, object and another object linked to the
> first object).
> Somehow this doesn't seem to be possible by using NSDictionary,
> which only allows 2 levels.
>
> Anyone, who has a workaround for this, would be highly appreciated !
>
> Kind regards
> Dirk Hoffmann
The number of "levels" is not relevant for saving. What is relevant is
what type of objects your dictionary contains. from the documentation
of -writeToURL:atomically:
This method recursively validates that all the contained objects are
property list objects (instances of NSData, NSDate, NSNumber,
NSString, NSArray, orNSDictionary) before writing out the file, and
returns NO if all the objects are not property list objects, since the
resultant output would not be a valid property list.
From your use of the words "linked to" I deduce that this is not
satisfies by your objects, as none of these types of objects can
"link" in any way.
Christiaan
DATE : Wed Mar 26 19:03:13 2008
On 26 Mar 2008, at 5:07 PM, <email_removed> wrote:
>
> Dear All,
>
> I tried to use a NSDictionary to save data from my application to a
> plist. It includes a key, and for each key an object (in my case a
> NSArray), works fine !!!
> Now i tried to go one step further for what I need to accomplish,
> instead of saving 2 levels (the key and the corresponding object) I
> want to save 3 levels (Key, object and another object linked to the
> first object).
> Somehow this doesn't seem to be possible by using NSDictionary,
> which only allows 2 levels.
>
> Anyone, who has a workaround for this, would be highly appreciated !
>
> Kind regards
> Dirk Hoffmann
The number of "levels" is not relevant for saving. What is relevant is
what type of objects your dictionary contains. from the documentation
of -writeToURL:atomically:
This method recursively validates that all the contained objects are
property list objects (instances of NSData, NSDate, NSNumber,
NSString, NSArray, orNSDictionary) before writing out the file, and
returns NO if all the objects are not property list objects, since the
resultant output would not be a valid property list.
From your use of the words "linked to" I deduce that this is not
satisfies by your objects, as none of these types of objects can
"link" in any way.
Christiaan
| Related mails | Author | Date |
|---|---|---|
| nutrition1 | Mar 26, 17:07 | |
| Christiaan Hofman | Mar 26, 19:03 | |
| Hamish Allan | Mar 26, 19:11 | |
| Andreas Mayer | Mar 26, 19:14 |






Cocoa mail archive

