iOS中编译器错误提示:property `xxx` not found on type `abc *`
为了使用Core Data,创建了一个
NSManagedObject
子类,其中声明了若干属性:
代码如下:
RAPItem.h
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@import UIKit;
@class NSManagedObject;
@interface RAPItem : NSManagedObject
@property (nonatomic, retain) NSString * itemName;
@property (nonatomic, retain) NSString * serialNumber;
@property (nonatomic) int valueInDollar;
@property (nonatomic, retain) NSDate * dateCreated;
@property (nonatomic, retain) NSString * itemKey;
@property (nonatomic, retain) UIImage * thumbnail;
@property (nonatomic) double orderingValue;//请注意这个属性!!!!
@property (nonatomic, retain) NSManagedObject *assetType;
- (void)setThumbnailFromImage:(UIImage *)image;
@end
RAPItem.m
#import "RAPItem.h"
#import <CoreData/CoreData.h>
@implementation RAPItem
@dynamic itemName;
@dynamic serialNumber;
@dynamic valueInDollar;
@dynamic dateCreated;
@dynamic itemKey;
@dynamic thumbnail;
@dynamic orderingValue;
@dynamic assetType;
//以下代码省略
然后在别的文件中使用这个类,然而一直提示
Property orderingVlue not found on object of type RAPItem *
。如图所示:
以下是引用声明:
#import "RAPItemBarn.h"
#import "RAPImageAlbum.h"
#import "RAPItem.h"
@import CoreData;
请问这是怎么回事?我试过这个类的其他属性都可以识别,就是这个属性一直出错误提示;而且按住command点击
orderingValue
还可以跳转到
RAPItem
类上,说明引用对了,但是为什么一直出这个错误提示呢?真是x了狗了
补一张core data的图:
啊成成成成君
9 years, 3 months ago