Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could I use "dataWithContentsOfURL" with "HTTP POST"

Tags:

ios

Currently, I'm using "dataWithContentsOfURL" to send data to server and I append the data to the URL as a HTTP GET request.

However, because some data lots of text, I would like to switch from HTTP GET to HTTP POST.

Hence, could 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

like image 397
user836026 Avatar asked Dec 16 '22 04:12

user836026


1 Answers

No, you can't do that. You really really should switch over to using an asynchronous NSURLConnection.

like image 160
Lily Ballard Avatar answered Jan 06 '23 21:01

Lily Ballard