I have an object HomeControlGroup which contains a Mutable Array of HomeControlAppliances
I can create an array of Groups initialised thus:
but can neither add HomeControlAppliances using the method
nor by simply adding an existing array using addObjectsFromArray
Any idea what is wrong? There are no compiler errors or warnings, no console messages...
addObject just destroys the object that I want to add and addObjectsFromArray kills the array.
Code:
@class HomeControlAppliance;
@interface HomeControlGroup : NSObject {
NSString *groupName;
NSInteger groupNumber;
NSMutableArray *homeControlAppliances;
}
@property (nonatomic,retain) NSString *groupName;
@property (nonatomic,assign) NSInteger groupNumber;
@property (nonatomic,retain) NSMutableArray *homeControlAppliances;
- (id) initGroup: (NSString *) newName groupNumber: (NSInteger)newNumber;
- (void) addHomeControlAppliance: (HomeControlAppliance *) newAppliance;
@end
Code:
- (id) initGroup: (NSString *) newName groupNumber: (NSInteger)newNumber {
self = [super init];
if (self != nil) {
self.groupName = newName;
self.groupNumber = newNumber;
[self.homeControlAppliances initWithCapacity: 10];
}
return self;
}
but can neither add HomeControlAppliances using the method
Code:
- (void) addHomeControlAppliance: (HomeControlAppliance *) newAppliance {
[self.homeControlAppliances addObject: newAppliance];
}
nor by simply adding an existing array using addObjectsFromArray
Any idea what is wrong? There are no compiler errors or warnings, no console messages...
addObject just destroys the object that I want to add and addObjectsFromArray kills the array.