iOS中编译器错误提示:property `xxx` not found on type `abc *`
ringa_lee
ringa_lee 2017-04-17 15:21:00
[iOS讨论组]

为了使用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的图:

ringa_lee
ringa_lee

ringa_lee

全部回复(2)
迷茫

好吧,纠结了一晚上之后,我将这个类删除,然后重建,这个警告就消失了,很无奈。

天蓬老师

你的coredata数据库里是不是没有这个字段啊,或者你的RAPItem类不是自动生成的,那个出错的个字段是你自己添加的。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号