Dumb ARC question
Dumb ARC question
- Subject: Dumb ARC question
- From: Rick Mann <email@hidden>
- Date: Wed, 26 Dec 2012 21:25:36 -0800
I just wrote some Objective-C++ code. It's basically just a regular Obj-C class, but makes some C++-style calls in its methods.
Anyway, I added an NSMutableData* ivar to my class, and set it with
mInputBuffer = [NSMutableData data];
in one of the methods. Subsequent accesses, however, have resulted in it being deallocated, even though I never set mInputBuffer to NULL anywhere.
I changed the code to refer to it via a strong property, and it's fine.
I thought ARC worked the same in both cases (that is, retained the object on assignment and kept it around until the last reference was gone, even if via a regular ivar)
A bit of googling confirms this, so I'm wondering what I've done wrong.
--
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden