-4

writeToURL

 NSString *url=@"http://192.168.1.100:88/outs.cgi?out=0";
    bool okay = [url writeToURL:url atomically:NO encoding:NSUTF8StringEncoding         
    error:NULL];
    if (!okay)
    {
        NSLog(@"Error writing to URL.");
    }

ObjectiveC does not work. I have a link to the electronic module to the LAN that is attached cord functions. Example: 192.168.1.100:88 / st0.xml and feedback are: visible content in the browser: 11111upupupup291157-890-890-000000-600-600-600-600-600-600 345325435643254364245624562465.

I'm interested in how to send a through writeToUrl and how to save it to a string that comes in response. Please help. This method back to me"Error writing to URL."

  • 1
    This has nothing to do with Xcode. -- Apart from that, you can't just write to an URL on the network like that (it would be scary if you could). You need to send a (HTTP?) request to the server which would then process the data sent and would save the results. –  Oct 26 '13 at 10:18
  • 2
    `[url writeToURL:url ...` does not make sense at all. First of all, `url` cannot be both the object to write (NSString) and the destination (NSURL). Second (from the documentation!), `writeToURL` supports only **file** URLs. - You probably need NSURLConnection. – Martin R Oct 26 '13 at 10:20
  • Have a look at http://stackoverflow.com/a/3935598/944634 – Parag Bafna Oct 26 '13 at 10:32

1 Answers1

4

From NSString writeToURL:atomically:encoding:error: documentation :

Only file URLs are supported.

You can not use network URL.

Parag Bafna
  • 22,812
  • 8
  • 71
  • 144