• 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
editing plist file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

editing plist file


  • Subject: editing plist file
  • From: "Renato Maschion" <email@hidden>
  • Date: Tue, 23 May 2006 23:43:56 -0700
  • Thread-topic: editing plist file

I have been reading the post about changing plist using NSMutableDictionary and I'm "almost" there.

I'm able to read a plist and search for certain keys and add or modify its contents.

I'm using for add/modify a key:
[myDict objectForKey:@"KEY1"] setValue: myArray forKey:@"ITEM1"];
where myArray is a NSArray with two items.

this is what I expect on my plist
<?xml version...>
<!DOCTYPE plist...>
<plist version="1.0")
<dict>
     <key>KEY1</key>
     <dict>
           <key>ITEM1</key>
           <array>
                 <integer>0</integer>
                 <true/>
            </array>

            <key>KEY2....
....


My problem now is how to add a new keys to the Root if they don't exist.
For example, if KEY1 doesn't exist I don't know how to create a new <dict> key.
I understand that key1 is a dict and must have a different syntax but I'm not finding.

Also, since we are talking about NSMutableDictionary: the plist I'm reading is in binary format. I can read with initWithContentsOfFile without problems. But when I save using
writeToFile:    atomically: YES it saves as xml.

Is there a way to save as binary again?

tks for helping...

renato
 _______________________________________________
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

  • Follow-Ups:
    • Re: editing plist file
      • From: Chris Suter <email@hidden>
  • Prev by Date: Re: Bold Text
  • Next by Date: Re: editing plist file
  • Previous by thread: Re: [nextCue setFloatValue:0.0]; doesn't work
  • Next by thread: Re: editing plist file
  • Index(es):
    • Date
    • Thread