0

UserInfo と Department という名前の 2 つのエンティティがあり、それぞれ対 1 関係と対多関係を持っています。アプリを実行すると、これが得られます。

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

何がうまくいかないのですか?

4

1 に答える 1

0

CoreData.frameworkfromをプロジェクトに追加BuildPhases->LinkBinaryWithLibrary->Add します。

于 2012-12-12T06:54:58.203 に答える