xml - iOS - Adding items to plist -


i'm writing plist 'nsmutabledictionary'. works ok.

but when want add file, new entry overrides first entry.

what i'd this:

<?xml version="1.0" encoding="utf-8"?> <names> <name1>     <key>         firstname     </key>     <value>         mememememe     </value>     <key>         lastname     </key>     <value>         mememememe     </value>  </name1> <name2>     <key>         firstname     </key>     <value>         mememememe     </value>     <key>         lastname     </key>     <value>         mememememe     </value>      </name2> </names> here's code far:        nsstring *filename = [documents stringbyappendingpathcomponent:@"faves.plist"];     nsmutabledictionary *loadedmiscdictionary = [nsmutabledictionary dictionarywithcontentsoffile:filename];   nsarray *directories = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);     nsstring *documents = [directories firstobject];      nsmutabledictionary *tempdict = [[nsmutabledictionary alloc] init];     [tempdict setvalue:firstnamestring forkey:@"firstname"];     [tempdict setvalue:secondnamestring forkey:@"secondname"];    [loadedmiscdictionary addentriesfromdictionary:tempdict];     [loadedmiscdictionary writetofile:filename atomically:yes]; 

please let me know i'm doing wrong. tia

update

i changed code snippet above..

you should use right click + add row top category , subcategories use + sign add new 1 in plist file


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -