views:

186

answers:

1

If I am adding an item to a dictionary like this:

[connectionHandlers setObject:projectsHandler forKey:[NSNumber numberWithInt:PROJECTS_CONNECTION_ID]];

Should I be retaining the NSNumber used for the key.

Also, when an object is added to an NSArray or NSDictionary, is it retained by the Array or Dictionary when added and released when removed?

I'm trying to get my head around Memory Management on the iPhone, and it's a doozy

+1  A: 

You do not need to retain it. Anytime you add keys or objects to dictionaries or arrays, the array or dictionary will retain it. If you retain it as well, it will be unnecessary.

coneybeare