Should all passed block handlers be nil out when the class is done running? What happen if none of the blocks are nil'ed at all?
For example, the following code:
- (void)runWithCompletionHandler:(void (^)(id results))completion
failureHandler:(void (^)(NSError *))failure {
self.completionHandler = completion;
self.failureHandler = failure;
[self run];
}
// Run will be overridden by subclass and
// finishWithResults will be called when subclass is done
- (void)run {
[self finishWithResults:nil];
}
- (void)finishWithResults:(id)results {
if (self.completionHandler) {
self.completionHandler(results);
// Question: Is it necessary to nil out the completion handler?
self.completionHandler = nil;
}
// Question: Should failure handler be nil out here as well?
}
- (void)finishWithErrors:(IHRCarPlayContent *)errors {
if (self.failureHandler) {
self.failureHandler(errors);
self.failureHandler = nil;
}
// Question: Should completion handler be nil out here as well?
}