Re: Method Sees Populated Array As Empty
Re: Method Sees Populated Array As Empty
- Subject: Re: Method Sees Populated Array As Empty
- From: Graham Cox <email@hidden>
- Date: Sun, 6 Jul 2008 14:39:32 +1000
On 6 Jul 2008, at 8:29 am, Mark Wales wrote:
@interface MyDocument : NSDocument
{
....
....
NSMutableArray *arrayOfReferences;
}
NSLog(@"%@", [self arrayOfReferences]); // <== Shows the array
as empty
Do you actually have an accessor method for arrayOfReferences? If not,
referring to the ivar using [self arrayOfReferences] isn't correct.
The fact it appears to work in some cases may be a blind fluke.
You need a method:
- (NSArray*) arrayOfReferences
{
return arrayOfReferences;
}
or just refer directly to the ivar:
NSLog(@"%@", arrayOfReferences);
hth,
Graham
_______________________________________________
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