user836026
user836026

Reputation: 11362

Could I use "dataWithContentsOfURL" with "HTTP POST"

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

Upvotes: 4

Views: 3537

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185811

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

Upvotes: 12

Related Questions