Skip to content

Instantly share code, notes, and snippets.

@breeno
Created October 16, 2013 15:57
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breeno/7010222 to your computer and use it in GitHub Desktop.
Save breeno/7010222 to your computer and use it in GitHub Desktop.
Hooking NSNotificationCenter to trace all messages. Useful stuff!
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(),
NULL,
notificationCenterHookProc,
NULL,
NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
void notificationCenterHookProc (CFNotificationCenterRef center,
void *observer,
CFStringRef name,
const void *object,
CFDictionaryRef userInfo)
{
NSLog(@"name: %@ userInfo:%@", name, userInfo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment