Skip to content

Instantly share code, notes, and snippets.

@inket
Created May 31, 2014 16:33
Show Gist options
  • Save inket/5ccfd8b64890c00cbd73 to your computer and use it in GitHub Desktop.
Save inket/5ccfd8b64890c00cbd73 to your computer and use it in GitHub Desktop.
Swizzling dynamically-loaded Lookup.framework
- (void)loadPlugin {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(bundleDidLoad:) name:@"NSBundleDidLoadNotification" object:nil];
}
- (void)bundleDidLoad:(NSNotification*)note {
if ([[note object] isKindOfClass:[NSBundle class]])
{
NSBundle* loadedBundle = [note object];
if ([@"com.apple.LookupFramework" isEqualToString:[loadedBundle bundleIdentifier]])
{
NSLog(@"Lookup framework loaded.");
[self swizzle];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment