Keep blocks inside a dictionary
I have my own method that takes a block as an argument. I want to keep track of that block inside an NSDictionary. What is the best way to add the block to the dictionary? I tried this code but after executing the line below (setObject...) the dictionary is still empty. I presume that is because the block is not of type NSObject. But what is the right way to do this? - (void)startSomething:(NSURLRequest*)request block:(void (^)(NSURLResponse*, NSData*, NSError*))handler { NSURLConnection *connection = [NSURLConnection connectionWithRequest:request delegate:self]; [pendingRequests setObject