Page 1 of 1

Calling Blocks

Posted: Tue Mar 29, 2016 5:25 pm
by hesitate
I use NSURLSession in my app and I need to set it up so that it does not follow redirects. The only way is to provide a delegate for:
https://developer.apple.com/library/mac ... onHandler:

Code: Select all

- (void)URLSession:(NSURLSession *)session
              task:(NSURLSessionTask *)task
willPerformHTTPRedirection:(NSHTTPURLResponse *)response
        newRequest:(NSURLRequest *)request
 completionHandler:(void (^)(NSURLRequest *))completionHandler
Now, I have a completionHandler block as a parameter and I need to call it with a Null parameter (to tell it not to follow the redirects).

I haven't found an example of how to call blocks provided by the AppKit.

Anyone can help? Thank you in advance.

Re: Calling Blocks

Posted: Tue Mar 29, 2016 5:42 pm
by wilbert

Re: Calling Blocks

Posted: Wed Mar 30, 2016 10:34 am
by hesitate
Thank you. That was all I needed to get it to work.