Xcode cfUserNotificationCreate的工作示例

Xcode cfUserNotificationCreate的工作示例,xcode,macos,Xcode,Macos,我正在寻找cfusernotificationcreate()的工作示例 或cfusernotificationNotify() 我尝试了几个选择,但都不适合我。这一个适合我 const void* keys[] = { kCFUserNotificationAlertHeaderKey, kCFUserNotificationAlertMessageKey, kCFUserNotificationCheckBoxTitlesKey, kCFUserNotific

我正在寻找cfusernotificationcreate()的工作示例 或cfusernotificationNotify()


我尝试了几个选择,但都不适合我。

这一个适合我

const void* keys[] =
{
    kCFUserNotificationAlertHeaderKey,
    kCFUserNotificationAlertMessageKey,
    kCFUserNotificationCheckBoxTitlesKey,
    kCFUserNotificationPopUpTitlesKey
};
CFTypeRef texKeys[3] = { CFSTR("1"), CFSTR("2"), CFSTR("3") };
CFArrayRef texVals = CFArrayCreate( NULL, texKeys, 3, &kCFTypeArrayCallBacks);

CFTypeRef paramKeys[4] = { CFSTR("1"), CFSTR("2"), CFSTR("3"), CFSTR("4") };
CFArrayRef paramVals = CFArrayCreate( NULL, paramKeys, 4, &kCFTypeArrayCallBacks);

const void* values[] =
{
    CFSTR("VBNIO"),
    CFSTR("parameters"),
    paramVals,
    texVals
};
CFDictionaryRef dict = CFDictionaryCreate(NULL, keys, values, sizeof(keys)/sizeof(*keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

SInt32 err32 = 0;
CFUserNotificationRef notif = CFUserNotificationCreate(NULL, 0, kCFUserNotificationPlainAlertLevel, &err32, dict);

CFOptionFlags responseFlags = 0;
SInt32 response = CFUserNotificationReceiveResponse(notif, 120, &responseFlags);
CFRelease(dict);
知道如何填写初始按钮值吗