On Fri, Apr 18, 2008 at 10:58 AM, Optical Ali <email@hidden> wrote:
>
> Hi,
>
> Does NSDictionary retain the objects (values) that are added?
Yes, it does. It retains the values and copies the keys.
> Shouldn't "n" be 2 below?
Looking for specific retainCount values is almost always the wrong
thing to do. If you follow the rules, you should never need to look at
retain counts. That said, your problem in this case is that you've got
the objects and the keys reversed in your initialization of the
dictionary. The dictionary is retaining its values (@"K", and @"A" in
this case) and *copying* it's keys (kArr and aArr in this case) this
is the reason that your retain count isn't what you expect.
Additionally, this is probably better addressed on the cocoa-dev
mailing list as it isn't a language question, but is actually a Cocoa
framework question.
--
Clark S. Cox III
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden
This email sent to email@hidden