I have a NetworkManager class which does the task of connecting to a JSON based web service and returning the server response. I am using a completion handler block to return the success or error response from NetworkManager (Internally, NetworkManager uses delegate based NSURLConnection).
NetworkManager *objNetworkManager= [[NetworkManager alloc]init];
[objNetworkManager setCompletionHandler:^(NSDictionary *resp, BOOL isSuccess){
if (isSuccess) {
}else{
}
}];
[objNetworkManager initiateUrlRequestWithInput:jsonRequestInput];
Everything works fine now and my network requests work as expected using this NetworkManager class. My concern is that I am allocating an instance of NetworkManager each time I make an web service call. But, where should I set the objNetworkManager to nil? Because it uses a block callback, I'm not sure how to handle memory efficiently. Please advice!!