Macos 用delphi-XE6在Mac OSX上显示通知
当我为mac OSX创建通知时。我可以设置通知的(唯一)名称,但标题不变。它只显示应用程序的名称Macos 用delphi-XE6在Mac OSX上显示通知,macos,delphi,notifications,firemonkey,delphi-xe6,Macos,Delphi,Notifications,Firemonkey,Delphi Xe6,当我为mac OSX创建通知时。我可以设置通知的(唯一)名称,但标题不变。它只显示应用程序的名称 procedure TPWTrayIcon.MacNotification(pTitle, pMessage: string); var Note : TNOtification; NoteCenter : TNotificationCenter; begin NoteCenter:=TNotificationCenter.Create(nil); try note
procedure TPWTrayIcon.MacNotification(pTitle, pMessage: string);
var
Note : TNOtification;
NoteCenter : TNotificationCenter;
begin
NoteCenter:=TNotificationCenter.Create(nil);
try
note := NoteCenter.CreateNotification(pTitle,pMessage,Now+EncodeTime(0,0,1,0));
try
note.AlertAction := 'Alert';
// note.name := pTitle;
// note.AlertBody := pMessage;
// note.FireDate := Now + EncodeTime(0, 0, 1, 0);
NoteCenter.ScheduleNotification(note);
finally
note.DisposeOf;
end
finally
NoteCenter.Free;
end;
正如您所注意到的,通知的名称是应用程序名称,无法通过当前的API对其进行更改。无论如何,由于它获得了应用程序名,您可以尝试作为一种解决方法(一种黑客行为),在运行时根据需要更改应用程序名 如果无法在FMX中更改应用程序名称,恐怕目前无法更改通知的标题 然而,Mac OS X中的通知标题永远是推送它的应用程序名称,因此我认为在Mac OS X规范中是以这种方式定义的