私はオブジェクトを持っています
id currentObject;
通知を通過させたいです。問題は、それを正しくリリースする方法がわからず、メモリ管理のドキュメントが私を夢中にさせていることです。
私は今このようにやっています:
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageReceived" object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[currentObject copy], @"key", nil]];
[currentObject release];
むしろそうすべきです:
[[NSNotificationCenter defaultCenter] postNotificationName:@"MessageReceived" object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[currentObject autorelease], @"key", nil]];
?
(iPhone、iOS4.0用です)
前もって感謝します!