2 lpploverou LPPloveROU 于 2012.12.12 16:42 提问

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

有两个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

2个回答

wangyaninglm
wangyaninglm   Ds   Rxr 2015.01.13 14:57
caozhy
caozhy   Ds   Rxr 2015.01.13 15:14
Csdn user default icon
上传中...
上传图片
插入图片