实体关系问题(核心数据)

时间:2012-12-12 06:32:06

标签: iphone core-data entity-relationship

我有两个名为UserInfo和Department的实体,它们在运行我的应用程序时分别具有一对一和多对多关系..

Undefined symbols for architecture i386:
  "_OBJC_METACLASS_$_NSManagedObject", referenced from:
      _OBJC_METACLASS_$_Department in Department.o
      _OBJC_METACLASS_$_UserInfo in UserInfo.o
  "_OBJC_CLASS_$_NSManagedObject", referenced from:
      _OBJC_CLASS_$_Department in Department.o
      _OBJC_CLASS_$_UserInfo in UserInfo.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

// Department.h

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

@class UserInfo;

@interface Department : NSManagedObject

@property (nonatomic, retain) NSString * id;
@property (nonatomic, retain) NSString * post;
@property (nonatomic, retain) NSSet *user;
@end

@interface Department (CoreDataGeneratedAccessors)

- (void)addUserObject:(UserInfo *)value;
- (void)removeUserObject:(UserInfo *)value;
- (void)addUser:(NSSet *)values;
- (void)removeUser:(NSSet *)values;
@end

// Department.m

#import "Department.h"
#import "UserInfo.h"

@implementation Department

@dynamic id;
@dynamic post;
@dynamic user;

@end
出了什么问题?

1 个答案:

答案 0 :(得分:0)

在项目的CoreData.framework中添加BuildPhases->LinkBinaryWithLibrary->Add