Cannot add NSObject to NSMutableArray

Discussion in 'iOS Programming' started by mrl72, Jan 25, 2011.

  1. mrl72 macrumors regular

    Apr 20, 2008
    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?
  2. North Bronson macrumors 6502

    Oct 31, 2007
    San José
    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.
  3. mrl72 thread starter macrumors regular

    Apr 20, 2008

Share This Page