核心数据自定义类未知链接器错误
大家好,我一直在引用这个项目,但我收到此链接器错误:
Undefined symbols:
"_OBJC_CLASS_$_NSManagedObject", referenced from:
_OBJC_CLASS_$_ParkingLot in ParkingLot.o
_OBJC_CLASS_$_Permit in Permit.o
"_OBJC_METACLASS_$_NSManagedObject", referenced from:
_OBJC_METACLASS_$_ParkingLot in ParkingLot.o
_OBJC_METACLASS_$_Permit in Permit.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
这是相关代码(我按照 this[向下滚动到“自定义托管对象类”]):
//Permit.h
#import <CoreData/CoreData.h>
@class ParkingLot;
@interface Permit : NSManagedObject
{
}
@property (nonatomic, retain) NSString * eligibility;
@property (nonatomic, retain) NSString * pricing;
@property (nonatomic, retain) NSString * type;
@property (nonatomic, retain) NSString * summary;
@property (nonatomic, retain) NSString * timeValid;
@property (nonatomic, retain) NSSet* parkingLots;
@end
@interface Permit (CoreDataGeneratedAccessors)
- (void)addParkingLotsObject:(ParkingLot *)value;
- (void)removeParkingLotsObject:(ParkingLot *)value;
- (void)addParkingLots:(NSSet *)value;
- (void)removeParkingLots:(NSSet *)value;
@end
//Permit.m
#import "Permit.h"
#import "ParkingLot.h"
@implementation Permit
@dynamic eligibility;
@dynamic pricing;
@dynamic type;
@dynamic summary;
@dynamic timeValid;
@dynamic parkingLots;
@end
//ParkingLot.h
#import <CoreData/CoreData.h>
@interface ParkingLot : NSManagedObject
{
}
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) id region;
@property (nonatomic, retain) NSSet* permits;
@end
@interface ParkingLot (CoreDataGeneratedAccessors)
- (void)addPermitsObject:(NSManagedObject *)value;
- (void)removePermitsObject:(NSManagedObject *)value;
- (void)addPermits:(NSSet *)value;
- (void)removePermits:(NSSet *)value;
@end
//ParkingLot.m
#import "ParkingLot.h"
@implementation ParkingLot
@dynamic title;
@dynamic region;
@dynamic permits;
@end
如果您看一下我遵循的示例代码,它几乎是相同的,但它拒绝工作,我不明白为什么。预先感谢您的任何帮助!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
愚蠢的我......我需要将核心数据框架添加到我的项目中。我可以发誓我已经做到了这一点……这就是我在凌晨编程所得到的结果。
Stupid me... I needed to add the Core Data framework to my project. I could have sworn I had already done this... that's what I get for programming into the wee hours of the morning.