Hi all, Thanks for your reply. I didn't retain that, I will try that as soon as I get home. Anyway, why I should retain that? Will it be released by "somebody"? Can anyone tell me the whole process and what's going on please? I want to know what happened. Thanks a lot.
On Tue, May 18, 2010 at 7:07 PM, Jack Nutting <jnutt...@gmail.com> wrote: > On Tue, May 18, 2010 at 12:40 PM, Sai <jche...@gmail.com> wrote: > > However, I declare a NSDictionary instance variable in my model object. > This > > NSDictionary instance > > store some data I need. And I will create this NSDictionary instance by > > invoking: > > [NSDictionary dictionaryWithObjects:names forKeys:keys] > > Are you retaining that? > > - (id)init { > if (self = [super init]) { > // assuming you have an ivar called "dict", this will lead to the > problem you define: > dict = [NSDictionary dictionaryWithObjects:names forKeys:keys]; > // but this should work: > dict = [[NSDictionary dictionaryWithObjects:names forKeys:keys] retain]; > } > } > > -- > // jack > // http://nuthole.com > // http://learncocoa.org > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com