K.W.
K.W.

Reputation: 141

Why does [copy] affected the NSArray in Xcode

The following was coded in a while loop

[array_stations addObject:[dic_stations copy]];

[array_stations addObject:dic_stations ];

What is the differences between them? if [copy] is not included, all the dictionary item will be the same inside the while loop, while NSLog the array.

If [copy] is added, all the items are list normally.

Thanks.

Upvotes: 0

Views: 50

Answers (1)

Prasad G
Prasad G

Reputation: 6718

[dic_stations copy] represents object of nsmutabledictionary. dic_stations represents object of nsdictionary. For more details click this link.

Upvotes: 1

Related Questions