NSManagedObject.h file not found

My RegistrationInfo.h

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@class NSManagedObject;

@interface SignupInfo : NSManagedObject

@property (nonatomic, retain) NSString * firstName;
@property (nonatomic, retain) NSString * lastName;
@property (nonatomic, retain) NSString * sex;
@property (nonatomic, retain) NSString * email;
@property (nonatomic, retain) NSNumber * zipcode;
@property (nonatomic, retain) NSString * password;
@property (nonatomic, retain) NSString * retypepassword;


@end

      

My RegistrationInfo.m

#import "SignupInfo.h"
#import "NSManagedObject.h"


@implementation SignupInfo

@dynamic firstName;
@dynamic lastName;
@dynamic sex;
@dynamic email;
@dynamic zipcode;
@dynamic password;
@dynamic retypepassword;

@end

      

I am getting a build error saying NSManagedObject.h file not found

I am using Core Data Model for RegistrationInfo

+3


source to share


6 answers


NSManagedObject

is defined in the .h file that is included <CoreData/CoreData.h>

. So you don't need to declare it and you don't need the #import statement.



+6


source


Have the same problem when I subclass NSManagedObject in the workspace.

Use the following declaration and then the problem went away.



#import <CoreData/NSManagedObject.h>

      

+2


source


  • Delete @class NSManagedObject;

  • Make sure you have imported the master data infrastructure (depending on the target OS).
+1


source


#import "NSManagedObject.h

Delete this operator and @class

Statement No need

+1


source


I am getting this error when subclassing NSMangedObject, but a workspace or project is specified for the group. If you choose the first FOLDER as your group, which has the same name as your project, the error should not occur and you should not have to modify the files generated by subclassing NSMangedObject.enter image description here

+1


source


This happens if you subclass Create NSManagedObject before adding CoreData.framework to the Build / Link Phase / Link using Libraries project . To fix the problem, just run the action again after adding the frame.

+1


source







All Articles