私はProduct
ヘッダーを持つモデルを持っています:
@interface Product : RLMObject <NSCopying,NSCoding>
{
}
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *thumbnailURL;
@property (nonatomic, strong) UIImage *thumbnail;
-(id)initWithInfo:(NSDictionary*)dictionary;
-(UIImage*)getThumbnail;
と実装:
@implementation Product
-(id)initWithInfo:(NSDictionary*)dictionary
{
self = [self init];
if (self) {
_title = dictionary[@"title"];
_thumbnailURL = dictionary[@"thumbnailURL"];
_thumbnail = [self getThumbnail];
}
return self;
}
-(UIImage*)getThumbnail
{
if (_thumbnail) {
return _thumbnail;
}
//load image from cache
return [self loadImageFromCache];
}
今、Product
オブジェクトを作成してに挿入しようとするとRealm
、常に例外が発生します
[RLMStandalone_Product getThumbnail]: unrecognized selector sent to instance 0xcd848f0'
今、私は削除_thumbnail = [self getThumbnail];
し、それは正常に動作します. しかし、その後、別の例外が発生します
[RLMStandalone_Product title]: unrecognized selector sent to instance 0xd06d5f0'
ビューをリロードすると。メイン スレッドでオブジェクトを作成Product
したので、そのプロパティとメソッドを使用しても問題ないはずです。
アドバイスをいただければ幸いです。