Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmiles fishman
Courses Plus Student 3,610 PointsWhat am I doing wrong?????!!
NSURL*url=[[NSURL alloc]initWithString:@"http://teamtreehouse.com"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDownloadTask*task=[session downloadTaskWithRequest:request completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error){
NSLog(@"Response:%@",response);
}];
[task resume];
}
2 Answers
Thomas Nilsen
14,957 PointsThe property NSURLSessionDownloadTask *task; is already made so all you need to do is:
task=[session downloadTaskWithRequest:request completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error){
NSLog(@"Response: %@",response);
}];
[task resume];
Misha Shaposhnikov
8,718 PointsThe Treehouse Code Challenge engine is really picky about these kinds of things. Add a space between the colon and the % symbol in the NSLog. If all else fails, here is what worked for me:
/* Add task 1 code here */
NSURL *url = [[NSURL alloc] initWithString : @"http://teamtreehouse.com"];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
NSURLSession *session = [NSURLSession sharedSession];
/* Add task 2 code below */
NSURLSessionDownloadTask *task;
task = [session downloadTaskWithRequest:request completionHandler:^(NSURL *location,NSURLResponse *response, NSError *error){
NSLog(@"Response: %@", response);
}];
[task resume];
Amit Bijlani please have a look at this. =)
miles fishman
Courses Plus Student 3,610 Pointsmiles fishman
Courses Plus Student 3,610 Pointsthis is part of the challenge