Reading a plist

Reading a plist

Post by Dale Stanb » Fri, 11 Mar 2005 20:09:20


I've successfully written a plist file using

writeToFile: @"/Users/dale/Desktop/data.plist" atomically: YES];

The file is created, and contains nothing but strings, dictionaries
and arrays. Property List Editor can display it successfully.

I can't read it back in successfully however. I've used...

N *** ableArray *result =
[N *** ableArray arrayWithContentsOfFile:
@"/Users/dale/Desktop/data.plist"];

and I check it with...

if (result == nil)

The de *** shows result as being 0...

Thanks,

Dale

--
XXXX@XXXXX.COM
 
 
 

Reading a plist

Post by Gregory We » Fri, 11 Mar 2005 20:36:45

In article < XXXX@XXXXX.COM >,



A plist file isn't an array. It's a dictionary.

--
There's nothing quite like the joy of first hearing an Alvin & the Chipmunks
cover of Pink Floyd's "The Final Cut." "Not Now John" is especially sublime.

 
 
 

Reading a plist

Post by Michael As » Fri, 11 Mar 2005 21:08:13


Not strictly true. A plist file can contain whatever you want at the top
level of the file, just like it can contain whatever you want at any other
level. I've used arrays as the top level of plist files without any
trouble. The original poster's problem lies elsewhere, although I don't
know where.
 
 
 

Reading a plist

Post by Dale Stanb » Fri, 11 Mar 2005 21:18:08


When I create the file (via writeToFile from an N *** ableArray) it
seems to work ok. Property List Editor shows the Root of the
property list as an array, and N *** ableDictionary doesn't respond
to arrayWithContentsOfFile.

I'm not sure where to go with your suggestion...

dale

--
XXXX@XXXXX.COM
 
 
 

Reading a plist

Post by Gregory We » Sun, 13 Mar 2005 20:48:02

In article < XXXX@XXXXX.COM >,




Too little sleep. Thanks for being gentle with the correction.

G

--
There's nothing quite like the joy of first hearing an Alvin & the Chipmunks
cover of Pink Floyd's "The Final Cut." "Not Now John" is especially sublime.