txt file on my domain and I can't manage to save into it, here is my code:
NSString *countstring = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.DomainName.com/MyAppName/count.txt"] encoding:NSUTF8StringEncoding error:nil];
int countInt = [countstring intValue];
NSLog(@"count string is:%i",countInt);
int newCount = countInt + 1;
NSLog(@"new count is: %i",newCount);
NSString *newString = [NSString stringWithFormat:@"%i",newCount];
[newString writeToURL:[NSURL URLWithString:@"http://www.DomainName.com/MyAppName/count.txt"] atomically:NO encoding:NSUTF8StringEncoding error:nil];
(I censored my domain name and app name)
The logs are:
count string is:0
new count is: 1
which is right! But when I open the file on the domain it is still 0. How can I fix it? Thanks!