ios - Replace some contents of NSMutableDictionary with another NSMutableDictionary -


i having 2 nsmutabledictionaries each has 5 nsarrays inside,

these 2 nsmutabledictionaries have excactly same 5 keys , nsarrays different content,

i need replace 2 arrays arrays of other nsmutabledictionary

dic1 = dic2; //isn't solution...will replace contents of 1 other... 

i need can replace object of specific key other same key.

i tried

[dic1 setobject:[dic2 objectforkey:@"key1"] forkey:@"key1"]; [dic1 setobject:[dic2 objectforkey:@"key2"] forkey:@"key2"]; 

and error: attempt insert nil value (key: key1)'

the error means [dic2 objectforkey:@"key1"] returning nil value. in other words, key not exist in dictionary. likewise, can't set nil value inside of nsdictionary, thats why error sent out.

print out each of dictionaries , ensure keys/values expect. can use nslog or pause program breakpoint, , enter po dic1 in console.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -