How do I populate an NSMutableArray in one class with another object?
- by AngeloS
Hello,
I know this is a simple answer, but I can't seem to find the solution. I created an object in its own class and I am trying to populate it with data from another class. For simple data types like NSString, I have no problem, but when trying make an NSMutableArray equal to another NSMutableArray or when I try to populate a NSMutableArray with another objects (like strings), I keep getting exception errors...
Here is the object I am trying to populate:
#import <Foundation/Foundation.h>
@interface RSSFeedList : NSObject {
NSString *subject;
NSMutableArray *rssfeedDetail;
}
@property (nonatomic, retain) NSString *subject;
@property (nonatomic, retain) NSMutableArray *rssfeedDetail;
@end
This is how I was able to populate the NSString 'subject' in another class:
rssFeedList.subject = @"test";
However, if I follow similar convention within that same class with respect to an Array, it throws an exception:
rssFeedList.rssfeedDetail = rssItemDetailArray;
Where rssItemDetailArray is a NSMutableArray that I have built in the same class.
I have also tried to add items (i tried strings for testing) to the NSMutableArray directly like so to no avail:
[rssFeedList.rssfeedDetail addObject:@"test"];
Any ideas?? Thanks in advance!!