I want to save a .txt file in my iPhone app, but I want it to persist such that I can still access it even if the app is uninstalled and reinstalled.
I have tried to save the file on the iPhone's hard disk but it never works.
This works on the simulator:
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
//NSString *dataFile= @"/Users/rajesh/Library/Application Support/iPhone Simulator/4.2/tmp/myfile.dat"; //on simulator
NSData *databuffer;
databuffer = [textBox.text dataUsingEncoding: NSASCIIStringEncoding];
[filemgr createFileAtPath: dataFile contents: databuffer attributes:nil];
[filemgr release];
And I use this on the device:
NSString *dataFile= @"/var/mobile/Applications/temp/myfile.dat"; //on device
but it's not working.