You can add a "private" property
@interface NetworkFetcher ()
@property (strong, nonatomic) NetworkFetcher *selfRef;
@end
in a class extension to the NetworkFetcher
class. In startWithCompletionHandler
, you set
self.selfRef = self;
to prevent the object from being deallocated. When the request has finished and the completion block has been called, set
self.selfRef = nil;
to destroy the retain cycle.