Can I use "dataWithContentsOfURL" with "HTTP POST",

I am currently using "dataWithContentsOfURL" to send data to the server, and I am adding the data to the URL as an HTTP GET request.

However, since some data contains a lot of text, I would like to switch from HTTP GET to HTTP POST.

Hence, can I use dataWithContentsOfURL with HTTP POST. Any example?

NSURL *url1 = [NSURL URLWithString:concatenatedString]; dispatch_async(kBgQueue, ^{ NSData* data = [NSData dataWithContentsOfURL: url1]; [self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES]; }); 

thanks

+4
source share
1 answer

No, you cannot do this. You really have to switch to using asynchronous NSURLConnection .

+12
source

Source: https://habr.com/ru/post/1395838/


All Articles