I am using CFNotificationCenterAddObserver() function to register a notification as below
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
NULL,
ringerSwitched,
CFSTR("com.apple.springboard.ringerstate"),
NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
Later at some point I am removing it via CFNotificationCenterRemoveEveryObserver() function as below but call back method is still getting called.
CFNotificationCenterRemoveEveryObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL);
I also used CFNotificationCenterRemoveObserver() function to unregister but no use.
CFNotificationCenterRemoveObserver (CFNotificationCenterGetDarwinNotifyCenter(), NULL, CFSTR("com.apple.springboard.ringerstate"), NULL);