tags:

views:

27

answers:

1

Hello,

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

A: 

I'm not sure about the NSString version of writeToURL:atomically:, but the NSData version says that it only works with file:// 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 use writeToURL:atomically:encoding:error: instead. Try it and see if the error result tells you anything.

JWWalker
Hmmm Okay well it looks like its back to curl. Thanks for the part about it being deprecated xcode didn't tell me.
happyCoding25