I need to send an object using CFNotificationCenterGetDarwinNotifyCenter()
however, I'm noticing that whenever I send a notification using
const void *tkeys[1] = { @"testKey" };
const void *tvalues[1] = { @"testValue" };
CFDictionaryRef userInfo = CFDictionaryCreate(NULL, tkeys, tvalues, 1, NULL, NULL);
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(),
CFSTR("foo"),
object,
userInfo,
true);
then I find that in the observer callback, the userInfo dict is NULL. Is there something I am missing here? Is there some other way by which I can possibly send the userInfo object? I was looking at http://nshipster.com/inter-process-communication/ and the Distributed Notifications part, however whenever I use :
CFNotificationCenterRef distributedCenter =
CFNotificationCenterGetDistributedCenter();
then I get an error Invalid Use of Function
error whenever I try it.