-
-
Save spnkr/e0f1206440a7b0ae8a46368b363b9078 to your computer and use it in GitHub Desktop.
Log all NSNotifications as they are fired
This file contains hidden or 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
static void LogNSNotifications(CFNotificationCenterRef center, | |
void *observer, | |
CFStringRef name, | |
const void *object, | |
CFDictionaryRef userInfo); | |
void LogNSNotifications(CFNotificationCenterRef center, | |
void *observer, | |
CFStringRef name, | |
const void *object, | |
CFDictionaryRef userInfo) { | |
NSLog(@"\n\nNotification Logged:"); | |
NSLog(@"observer %@", [(__bridge NSObject *)observer debugDescription]); | |
NSLog(@"object %@", [(__bridge NSObject *)object debugDescription]); | |
NSLog(@"name: %@", name); | |
NSLog(@"userinfo: %@", userInfo); | |
} | |
// then in your app delegate, call this function: | |
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), | |
NULL, | |
LogNSNotifications, | |
NULL, | |
NULL, | |
CFNotificationSuspensionBehaviorDeliverImmediately); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment