To ensure the file is overwritten for each new session, simply delete the file when a new session starts.
To append to a file, you can use an NSOutputStream
to write the data. Open the file for appending. But if you are writing a plist file from an NSDictionary
, then this won't work. The better solution would be to load the dictionary at app startup, update it in memory as the apps runs, and write the dictionary to a file when the app enters the background. This assumes your "session" isn't defined by app startups (or background/foreground transitions).