Hi there!,
I have an object
id currentObject;
which I want to pass through notification. The problem is I don't know how to release it correctly and the memory management documentation is driving me crazy.
I am doing it like this right now:
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageReceived" object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[currentObject copy], @"key", nil]];
[currentObject release];
Should it rather be:
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageReceived" object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[currentObject autorelease], @"key", nil]];
?
(it is for the iPhone, iOS4.0)
Thanks in advance!