ios - NSDictionary with no data at all -


i trying save data plist file created xcode.

var dict: nsmutabledictionary = nsmutabledictionary(contentsoffile: plistpath);  dict = nsmutabledictionary(dict.setvalue(speedstring, forkey: "speed"));  if (!dict.writetofile(plistpath, atomically: true)) {     nslog("failed save data"); } 

the dictionary safely wrote file.
problem set break point after if statement, debugger showed nsdictionary has 0key/value pair, weird. in xcode, added key/value pair in it.

i added code test

if (dict.valueforkey("speed") == nil) {     nslog("key missing"); } 

the console did print out "key missing".

your second line creates new dictionary. throwing away dictionary read in first line. not appending dictionary, replacing new empty dictionary.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -