I am trying to inset key value pair with dynamic array values with following code. It replace the array content of all values with last stored array object. Please suggest how to store copy of array instead of reference. Sample code:
for (i = i - 1; i >= 0; i--) {
[dict setObject:urlArray forKey:rootDate];
[urlArray removeAllObjects];
[urlArray addObject:[[history objectAtIndex:i] objectAtIndex:0]];
}
Also tried for setValue method returning same result.
{
"18/03/15" = (
"http://www.yahoo.com"
);
"24/03/15" = (
"http://www.google.com",
"http://www.youtube.com"
);
} Actual Output received:
{
"18/03/15" = (
"http://www.google.com",
"http://www.youtube.com"
);
"24/03/15" = (
"http://www.google.com",
"http://www.youtube.com"
);
}