My code is writing contents of url from an xml file on my web server and stores the contents in a string then write it to a local file in documents directories. Everything is going fine with me when I load it for the first time, after that even when I run this view again it will always get the contents which is already cached on the device and no updates are coming from the web server.
How to enforce it to read the contents from the file on the server at everytime?
NSString * path = @"http://my-domain-name.com/myGlobalFile.xml";
NSString * myStr = [NSString stringWithContentsOfURL:[NSURL URLWithString:path] encoding:NSUTF8StringEncoding error:nil];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
localFilePath = [documentsDirectory stringByAppendingPathComponent:@"myLocalFile.xml"];
[myStr writeToFile:localFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil];