NSDate値をアプリケーションのplistファイルに保存する方法を理解しようとしています。
私は現在これを行っていますが、それを保存しなければならない実際の部分で立ち往生しています。
NSString *datePlistPath = [[NSBundle mainBundle] pathForResource: @"my-Date" ofType: @"plist"];
NSMutableDictionary *dict = [NSDictionary dictionaryWithContentsOfFile: datePlistPath];
// to be saved to plist
NSDate *date = [NSDate date];
// this is where I start to get abit lost, I want to set the date to the right plist value then commit the changes
[dict setObject:date forKey:@"my-Date"];
[dict writeToFile:datePlistPath atomically:YES]; // error happening here.
助けていただければ幸いです
更新:コードの最後の行に到達すると、これが生成されるエラーです...
*キャッチされなかった例外'NSInternalInconsistencyException'が原因でアプリを終了しています、理由:'-[__ NSCFDictionary setObject:forKey:]:変更メソッドが不変オブジェクトに送信されました'