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 trial
Derek Medlin
6,151 PointsNSURLSession delegate
I can't seem to get the NSURLSession delegate to fire. What all do i need to do? I have all 4 of the delegate protocols implemented but they never seem to fire. For a UITextField delegate, you would assign the delegate by saying textField.delegate = self; but i'm lost on the NSURLSession. Basically my goal is to have a UIProgressView show the progress of a NSURLSessonDownloadTask, i know what to do but just need help with the delegate. Thanks
1 Answer
Derek Medlin
6,151 PointsNever mind, I was using...
- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURL *location, NSURLResponse *response, NSError *error));
and apparently you can't use the completion block or the delegate will not fire, instead this worked for me.
- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request;
Now the delegate gets fired.