I am trying to declare a NSMutableArray to use to hold some Contact
objects. I am following the instructions given in this question, how and where do I initialize an global NSMutableArray in Xcode 5. But have left off the @synthesize
because according to this wikipedia page it says that it is implicit in newer versions of xcode. I have also tried including it and get the same errors so I don't think it is the problem but I just thought I would mention it.
I am getting these errors but can't figure out what exactly they mean because according to these questions:
Type of class in a NSMutableArray
Can I restrict the NSMutableArray object type?
Is there any way to enforce typing on NSArray, NSMutableArray, etc.?
NSMutableArrays do not enforce the types of objects that are placed into them.
What am I doing wrong and what do these errors mean? This is my first Objective C project and I believe this is a simple problem but nevertheless it is one that I have not been able to figure out and has been frustrating me for hours.
Here is my header file:
#import <Foundation/Foundation.h>
#import "Contact.h"
@interface ContactList : NSObject
@property (strong, readwrite, nonatomic) NSMutableArray *contactList;
+ (BOOL) addContact: (Contact *) contact;
- (BOOL) emptyContactList;
//- (BOOL) buildContactList
@end
and here is my implementation file:
#import "ContactList.h"
@implementation ContactList
contactList = [[NSMutableArray alloc] init];
+ (BOOL) addContact: (Contact *) contact
{
return YES;
}
- (BOOL) emptyContactList
{
return YES;
}
@end