View Full Version : Cannot add NSObject to NSMutableArray

Jan 25, 2011, 11:24 PM
Tearing my hair out over this one and not sure what I'm doing wrong. I have an object called "Feed" as such:

@interface Feed : NSObject {
NSString *feedId;

@property (nonatomic, copy) NSString *feedId;

@implementation Feed
@synthesize feedId;


In a method in my viewcontroller :

NSMutableArray *feedArray = [[NSMutableArray alloc] init];
Feed *feed = [[[Feed alloc] init] autorelease];
feed.feedId = @"test";
[feedArray addObject:feed];
NSLog([feedArray description]);

This is what I get:

2011-01-26 00:19:40.628 ffeed[33447:207] (

I have another class I set up exactly the same way and that works fine and the code looks identical, so maybe I missed a step somewhere. But then again it is late!

Any ideas?

North Bronson
Jan 25, 2011, 11:33 PM
When you call:

[feedArray description];

You can think of this as recursively asking each object in that array for its description. It looks like you haven't really taught your Feed objects how to describe themselves.

Jan 26, 2011, 12:32 AM
Told you it was late lol.