Created
June 28, 2016 14:21
-
-
Save oscahie/5ee213b7f0bd0dbe301affc254450d93 to your computer and use it in GitHub Desktop.
track object deallocations on Apple frameworks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <objc/runtime.h> | |
@implementation AVPlayerItem(oscahie) | |
+ (void)load | |
{ | |
Method origMethod = class_getInstanceMethod([self class], NSSelectorFromString(@"dealloc")); | |
Method patchMethod = class_getInstanceMethod([self class], @selector(swizzledDealloc)); | |
method_exchangeImplementations(origMethod, patchMethod); | |
} | |
- (void)swizzledDealloc | |
{ | |
NSLog(@"deallocating object <%@: %p>", [self class], self); | |
[self swizzledDealloc]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment