I have added AFNetworking using cocoapods and I need to modify UIActivityIndicatorView+AFNetworking.m category, and more specific I need to add a custom logging statement used in my project to the end of dealloc method.
- (void)dealloc {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
[notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];
[notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];
[notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];
#endif
[notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil];
[notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil];
}
Is it possible to swizzle/subclass/modify/etc this dealloc method?
You need to stop using it via cocoapods and instead fork your own version of the AFNetworking repo on github and use that instead.
In this way you have the opportunity to give any improvements you make back to the community.