I found the answer to my problem but I don't know why it was a problem? I am wondering if someone can shed light on it so I understand it better.
This is the new functioning code to get the contents of a URL, I changed the URL for this sample.
It seems straight forward, but its not. To make sure I get the URL correct I have been copying the URL from Firefox and pasting it into my xcode project. But when I copy / paste the FireFox URL looks like this
When I paste it into Xcode it adds the http: before it and it looks like this
Now, it loads just fine, no problems. But when I open the txt file with a program like Transmit, edit the data and re save the file, it will not load the updated content? It always refers to the old data?
But if the "www" is in the string, ie "http://www." it reloads the data just fine? I don't understand why it will load it once ok, it finds the file just fine without www, but it won't reload the updated content, it just refers to the old file some how?
Last thing, I know it was refering to the old file because I added code to NSLog the modification date of the file and even though I made changes to the remote txt file it still displayed the same date.
Why?
This is the new functioning code to get the contents of a URL, I changed the URL for this sample.
Code:
NSURL *urlToFile = [NSURL URLWithString:@"http://www.mySite.com/clients/clients_wine.txt"];
remotelist = [NSString stringWithContentsOfURL:urlToFile encoding:NSUTF8StringEncoding error:&error];
if (error) {
NSLog(@"Error: %@", error);
}
It seems straight forward, but its not. To make sure I get the URL correct I have been copying the URL from Firefox and pasting it into my xcode project. But when I copy / paste the FireFox URL looks like this
mySite.com/clients/clients_wine.txt
When I paste it into Xcode it adds the http: before it and it looks like this
Now, it loads just fine, no problems. But when I open the txt file with a program like Transmit, edit the data and re save the file, it will not load the updated content? It always refers to the old data?
But if the "www" is in the string, ie "http://www." it reloads the data just fine? I don't understand why it will load it once ok, it finds the file just fine without www, but it won't reload the updated content, it just refers to the old file some how?
Last thing, I know it was refering to the old file because I added code to NSLog the modification date of the file and even though I made changes to the remote txt file it still displayed the same date.
Why?