I have been working on an app all day which has been working fine until Xcode downloaded libraries or something and then it started having issues. I am just trying to create the getter/setter methods to get a couple of arrays out of my APPDelegate. Like I said it was working fine and then randomly it showed up with this error and now won't build anymore:
property with 'retain(or strong)' attribute must be of object type
Here is the rest of the code:
#import <Foundation/Foundation.h>
#import "Project.h"
#import "TeamMember.h"
@interface Task : NSObject{
NSDate *endDate;
NSDate *startDate;
NSMutableString* notes;
NSMutableString* taskName;
//The error appears first right here over teamMember
TeamMember *teamMember;
Project *project;
}
//The error appears over both of the following lines as well...
@property (nonatomic, retain)TeamMember *teamMember;
@property (nonatomic, retain) Project * project;
@property (nonatomic, retain) NSMutableString *notes;
@property (nonatomic, retain) NSMutableString *taskName;
@property (nonatomic, retain) NSDate *startDate;
@property (nonatomic, retain) NSDate *endDate;
@end
Any ideas? This has got me stumped....
Here is Project.h:
#import <Foundation/Foundation.h>
#import "Task.h"
@interface Project : NSObject{
NSDate *dueDate;
NSDate *startDate;
NSArray *tasksInProject;
NSMutableString* notes;
NSMutableString* description;
NSMutableString* projectName;
}
@property (nonatomic, retain) NSDate *startDate;
@property (nonatomic, retain) NSDate *dueDate;
@property (nonatomic, retain) NSArray *tasksInProject;
@property (nonatomic, retain) NSMutableString *description;
@property (nonatomic, retain) NSMutableString *projectName;
@end
Here is TeamMember.h
#import <Foundation/Foundation.h>
#import "Task.h"
#import "Project.h"
@interface TeamMember : NSObject{
NSMutableArray *projects;
NSMutableString *name;
NSMutableString *title;
NSMutableString *email;
NSMutableString *phone;
NSMutableString *notes;
}
//@property(nonatomic, retain) NSArray *projects;
@property (nonatomic, retain) NSMutableString *name;
@property (nonatomic, retain) NSMutableString *title;
@property (nonatomic, retain) NSMutableString *email;
@property (nonatomic, retain) NSMutableString *phone;
@property (nonatomic, retain) NSMutableString *notes;
@end
It looks like it's caused by recursively including of header files.
Try to add @class Project and @class TeamMember into your Task.h, like this
#import <Foundation/Foundation.h>
#import "Project.h"
#import "TeamMember.h"
@class TeamMember;
@class Project;
@interface Task : NSObject{
NSDate *endDate;
NSDate *startDate;
...
}
@end