I'm using this code to download a page to an NSData then convert it to an NSString.
Code:
NSURL *url = [NSURL URLWithString:@"someaddress.com"];
NSError *error;
NSMutableURLRequest* liveRequest = [[NSMutableURLRequest alloc] initWithURL:url];
[liveRequest setCachePolicy:NSURLRequestReloadIgnoringCacheData];
//Need a header for something
[liveRequest setValue:@"headervalue" forHTTPHeaderField:@"headerfield"];
//Download the page to an NSData
NSURLResponse* response;
NSData* myData = [NSURLConnection sendSynchronousRequest:liveRequest returningResponse:&response error:&error];
//Convert the data into a string.
NSString * checkResponse = [[NSString alloc] initWithData:myData encoding:NSASCIIStringEncoding];
This locks up the UI so I was wondering how I can change this into an Asynchronous request, keeping the header information and what not.
Thanks,
Tom