// in the -init method storage is set up for fieldArray
// return a Foo from the array
- (Foo*)fooAtIndex:( NSUInteger )index
{
return [ fieldArray objectAtIndex:index ];
}
If I add foos to the array like this...
- (void)addFoo:( Bar* )inFoo
{
[ fieldArray addObject:inFoo ];
}
... everything is fine.
If, however, I implement addFoo like this...
- (void)addFoo:( Bar* )inFoo
{
[ self.fieldArray addObject:inFoo ];
}
... the contents of foo are invalid when I return one using fooAtIndex:
So, the question is, what is the difference between using self.
notation and not? I have declared the properties to retain the
objects. The compiler is happy, I just die at run time when I attempt
to access the contents of a Foo. It looks like the contents of Foo
are not retained in the second case. I've concluded that it's a bad
thing to use the self. notation in general usage, but it is not at all
clear to me why this is true and I cannot find any warning against
this in the Obj C docs on Apple's web site.
Thanks for any insight.
-Craig
_______________________________________________
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