iOS provides application specific temporary folder. The benefit in using this is that even if the worst case happens and your app fails to clean up temporary files for some reason (try to view 65 MB image, for example), application temporary folder is automatically cleaned out every 3 days. Your application is thus not able to leave behind "zombie" files, which would fill up device harddisk until all available space is used!
NSString *fileName = @"note.txt";During development you want to check that temporary files are created and deleted, as planned. Easiest way is to use iPhone simulator and keep Finder window open for NSTemporaryDirectory. You can find it using:
NSString *tempFilePath = [NSString stringWithFormat:@"%@%@",
NSLog(@"%@", self.dataPath);Just beware that whatever you put there will be available even after application closing and relaunch as well as system reboot - for about 3 days.