So my problem is that i don’t know how to update a simple txt file. So what i have is that my app always read something from one file. Than i want to update this file with some stuf i bring down from internet. So what i can do is this:
NSString *index2 = [documentsDirectory stringByAppendingPathComponent:@"something.txt"];
NSURL *url = [NSURL URLWithString:@"url to file"];
NSData *urlData = [NSData dataWithContentsOfURL:url];
[urlData writeToFile:index2 atomically:YES];
So i downloaded the updated file and saved it to phone memory in documents Directory. But what i don’t understand is how to overwrite a file for example index1 which i have in my bundle resources.
Thanks for the replieys.
You don’t want to overwrite the file that is in your bundle. What you should do is when the app starts:
The idea is that your bundle never changes but your app relies on the copy that you made in Documents/ so that’s the one you have to keep up to date.