I released an app that the user can edit some pictures and save it on the own app (I mean: it is not saved on camera roll). Sometime after, I released the version 2.0 of the app and the users complained the update process deleted their saved pictures.
It follows part of my code where the pictures are saved:
NSData *dataFromPNG = UIImagePNGRepresentation(image);
NSString *mainPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingString:@"/SavedData"];
NSString *directory = [mainPath stringByAppendingPathComponent:[NSString stringWithFormat:@"image(%d).png", imageIndex]];
[dataFromPNG writeToFile:directory atomically:YES];
Where is my mistake?