您需要使用kCFUserNotificationAlertTopMostKey
密钥。
extern CFStringRef kCFUserNotificationAlertTopMostKey;
CFStringRef keys[] = {
kCFUserNotificationAlertTopMostKey,
kCFUserNotificationAlertHeaderKey,
kCFUserNotificationAlertMessageKey
};
CFStringRef values[] = {
kCFBooleanTrue,
CFSTR("Title"),
CFSTR("Message")
};
CFDictionaryRef dict = CFDictionaryCreate(NULL, keys, values,
sizeof(keys)/sizeof(*keys),
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
SInt32 err = 0;
CFUserNotificationRef notif = CFUserNotificationCreate(NULL,
0, kCFUserNotificationPlainAlertLevel, &err, dict);
CFRelease(dict);
...
有关 iPhone OS ≤ 3.1 的所有对话框描述键,请参阅http://iphonedevwiki.net/index.php/CFUserNotification。
(请注意,虽然它会显示在锁定屏幕上,但手机不会自行唤醒。)