Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 26, 2011, 12:24 AM   #1
mrl72
macrumors regular
 
Join Date: Apr 2008
Cannot add NSObject to NSMutableArray

Tearing my hair out over this one and not sure what I'm doing wrong. I have an object called "Feed" as such:

Code:
@interface Feed : NSObject {
	NSString *feedId;
}

@property (nonatomic, copy) NSString *feedId;
@end

----------
@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] (
(null)
)

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?
mrl72 is offline   0 Reply With Quote
Old Jan 26, 2011, 12:33 AM   #2
North Bronson
macrumors 6502
 
Join Date: Oct 2007
Location: Los Angeles
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.
North Bronson is offline   0 Reply With Quote
Old Jan 26, 2011, 01:32 AM   #3
mrl72
Thread Starter
macrumors regular
 
Join Date: Apr 2008
Told you it was late lol.

Thanks!
mrl72 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
nsmutablearray tacotester1 iPhone/iPad Programming 6 Apr 10, 2014 05:18 PM
NSMutableArray always replacing last value. DavidBlack Mac Programming 16 Dec 15, 2013 04:49 PM
Objective-C help with NSMutableArray dancks Mac Programming 4 Apr 15, 2013 05:25 PM
Resolved: Add content form a UITextfield to an NSMutableArray everytime a button is clicked fstigre iPhone/iPad Programming 13 Nov 17, 2012 10:07 AM
How to check if an object is NSObject or CFTypeRef namanhams iPhone/iPad Programming 2 Aug 1, 2012 06:08 AM

Forum Jump

All times are GMT -5. The time now is 07:24 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC