I am trying to use
NSString *myString = @"NO";
[myString writeToURL:[NSURL URLWithString:@"http://example.com/text.txt"] atomically:YES];
But am having no luck. myString is set to NO and example.com is set to the correct website. The only issue I could see would be text.txt already existing? Can writeToURL even write to http? I can always go back to using NSTask and curl but that was a nightmare. 🙂
Thanks for any help
I’m not sure about the NSString version of
writeToURL:atomically:, but the NSData version says that it only works withfile://URLs, so I wouldn’t be shocked if the NSString version was the same.Edit to add: the NSString version of
writeToURL:atomically:is deprecated. You’re supposed to usewriteToURL:atomically:encoding:error:instead. Try it and see if the error result tells you anything.