我想一個NSMutableArray
添加到NSDictionary
但在日誌中顯示NSDictionary
,當我得到這個問題:ADDOBJECT NSMutableArray的一個NSDictionary中
)' of class '__NSCFArray'. Note that dictionaries and arrays in
property lists must also contain only property valúes.
這是我用來創建NSMutableDictionary
NSMutableDictionary *training = [[NSMutableDictionary alloc] init];
[training setObject:[NSNumber numberWithInt:eltiempo] forKey:@"tiempototal"];
[training setObject:[NSNumber numberWithFloat:totalkm] forKey:@"distanciatotal"];
[training setObject:[NSNumber numberWithInt:(int)(velocidadmedia/60)] forKey:@"velocidadmedia"];
[training setObject:[NSString stringWithFormat:@"%2d:%02d min/km"] forKey:@"fecha"];
[training setObject:posiciones forKey:@"posiciones"];
代碼
其中posiciones是我想要添加的數組。我將這個字典保存在一個數組中以便將其保存在用戶默認值中。但因爲我有這個問題,NSDictionary
沒有創建。
感謝您的幫助。
佩德羅
也許這不是問題,但我看到關鍵字「fecha」的無效字符串格式。 – Mat
'posiciones'是什麼類型? – DarkDust
您沒有粘貼整個日誌消息。問題似乎是數組或字典包含不屬於祝福屬性列表類型組(NSString,NSArray,NSDictionary,NSDate,NSData,NSNumber)的對象。 –