Skip to content

Instantly share code, notes, and snippets.

@knmshk
Created July 1, 2012 08:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save knmshk/3027474 to your computer and use it in GitHub Desktop.
Save knmshk/3027474 to your computer and use it in GitHub Desktop.
sample : sendAsynchronousRequest
xmlData = [[NSMutableData alloc] init];
NSURL *url = [NSURL URLWithString:
@"http://forrums.bignerdranch.com/smartfeed.php?"
@"limit=NO_LIMIT&count_limit20&sort_by=standard&"
@"feed_type=RSS2.0&feed_style=COMPACT"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
//connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
NSOperationQueue *queue = [[NSOperationQueue alloc]init];
[NSURLConnection sendAsynchronousRequest:request
queue:queue
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error){
if (error) {
xmlData = nil;
NSLog(@"error:%@", error.localizedDescription);
}
[xmlData appendData:data];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment