С CFNotificationCenterPostNotification
вы можете сделать это:
// ~~~~~~~~~~~~~~~~~~~
// SOMEWHERE IN A FUNCTION OR METHOD:
// ~~~~~~~~~~~~~~~~~~~
id object = /* Assume this exists */;
CFNotificationCenterPostNotification(aCenter, CFSTR("NotificationName"), (__bridge void *) object, NULL, true);
// ~~~~~~~~~~~~~~~~~~~
// LATER IN YOUR CODE:
// ~~~~~~~~~~~~~~~~~~~
void receivedNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{
id object = (__bridge id) object;
/* Do stuff with `object`. */
}
Не указывайте __bridge
s, если вы не используете ARC.