0

私はiOSアプリを開発しています。1 つのプロパティを定義する NSObject を拡張するクラスがあります。

//.h file
@property (nonatomic,retain) NSMutableDictionary *livedata; 


//.m file
if(self = [super init]){
    self.livedata = [[NSMutableDictionary alloc] init];
    [self.livedata setValue:@"myvalue" forUndefinedKey:@"myUndefinedKey"];
}

このエラーが発生しています。 *キャッチされない例外 'NSUnknownKeyException' が原因でアプリを終了しています。理由: '[ setValue:forUndefinedKey:]: このクラスはキー myUndefinedKey のキー値コーディングに準拠していません。

過去にkvc、kvoにNSMutableDictionaryを使用しました。はい、クラスが kvc に準拠していません。

4

2 に答える 2