On 20/01/2010, at 5:33 AM, Shawn Rutledge wrote:

> I forgot to mention, another problem I ran into was that my dictionary
> is a member variable of my UIViewController, I inited it in
> initWithNibName, then later when I go to use it in another member
> function, I found that it had been garbage-collected.  I used other
> member variables the same way, but only the dictionary got
> garbage-collected.  So I fixed it by doing [myDict retain]; in the
> initWithNibName, but didn't understand why such a thing should be
> necessary.


Uh-oh, category error.

UIViewController is an iPhone class, therefore you must be programming on 
iPhone, right? Which does not have garbage collection. Therefore your 
assumptions about what is happening are wrong. You MUST learn the memory 
management rules and have them down pat so you can write correctly managed code 
without having to really think about it.

--Graham


_______________________________________________

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

Reply via email to