I'm writing a save game function for an iPad game, and really only need 1 savegame. However, I'm not sure if I should account for some kind of savegame corruption and use current/previous save in case one gets corrupted.
Can iOS device events,interrupt the atomic writing operation and leave my save in a corrupted state? I'm talking about stuff like device being turned off, multitasking, home button, phone calls,etc. I know that the definition of atomic means it should not, but I would like to make sure.
+(void)writeSaveGameData:(NSData*)data
{
if(data == nil)
{
return;
}
[data writeToFile:[SaveGame savegamePath] atomically:YES];
}
+(NSData*)saveGameData
{
return [NSData dataWithContentsOfFile:[SaveGame savegamePath]];
}