当我为mac OSX创建通知时。我可以设置通知的(唯一)名称,但标题不变。它只显示应用程序的名称。
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;

发布于 2014-09-06 19:41:58
正如您所注意到的,通知的名称是应用程序名称,并且无法通过当前API更改它。无论如何,由于它获得了应用程序名称,因此您可以尝试在运行时根据需要更改应用程序名称作为一种变通方法(一种技巧)。
如果在FMX中更改应用程序名称是不可能的,那么目前恐怕也没有办法更改通知的标题。
然而,在Mac中,通知标题总是推送它的应用程序名称,所以我认为在Mac规范中是这样定义的。
https://stackoverflow.com/questions/25681532
复制相似问题