Calling Blocks

Mac OSX specific forum
hesitate
User
User
Posts: 11
Joined: Tue Mar 01, 2016 2:00 pm

Calling Blocks

Post 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.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Calling Blocks

Post by wilbert »

Windows (x64)
Raspberry Pi OS (Arm64)
hesitate
User
User
Posts: 11
Joined: Tue Mar 01, 2016 2:00 pm

Re: Calling Blocks

Post by hesitate »

Thank you. That was all I needed to get it to work.
Post Reply