-(id)init{
if (self==[super init]) {
NSMutableArray *listname = [[NSMutableArray alloc]initWithObjects:@"cu",@"al",@"zn",@"au",@"ru",@"fu",@"rb",@"pb",@"wr", nil];
NSMutableArray *listVolumn = [NSMutableArray arrayWithCapacity:[listname count]];
for (int i=0; i<[listname count]; i++) {
[listVolumn addObject:[NSNumber numberWithLong:0]];
}
nsmutabledictionary = [[NSDictionary alloc] initWithObjects:listVolumn forKeys:listname];
}
return self;
}
私のinitメソッドでは、2つのNSMutableArrayを定義し、NSMutableDictionary nsmutabledictionaryに追加しました。[__NSCFDictionary setObject:forKey:]:変更メソッドが不変オブジェクトに送信
[nsmutabledictionary setObject:[NSNumber numberWithLong:100] forKey:@"cu"];
が、それは上記の行でクラッシュ:
ありがとう、ありがとうございます。 – Gaojian922188