Ich brauche ein Objekt mit CFNotificationCenterGetDarwinNotifyCenter()
jedoch zu schicken, ich bin zu bemerken, dass, wenn ich eine Benachrichtigung mitWie kann ich ein userinfo DIKT CFNotificationCenterGetDarwinNotifyCenter send()
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);
dann sende ich feststellen, dass in dem Beobachter Rückruf , das userInfo-dict ist NULL. Gibt es etwas, das mir hier fehlt? Gibt es eine andere Möglichkeit, wie ich das userInfo-Objekt senden kann? Ich war auf der Suche auf http://nshipster.com/inter-process-communication/ und der Distributed Benachrichtigungen Teil, aber wenn ich verwende:
CFNotificationCenterRef distributedCenter =
CFNotificationCenterGetDistributedCenter();
dann erhalte ich einen Fehler Invalid Use of Function
Fehler, wenn ich es versuchen.
Vielen Dank. Das ist eine fantastische Antwort. –