当我为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;
答案 0 :(得分:0)
您注意到通知的名称是应用程序名称,无法通过当前API更改它。无论如何,因为它获取应用程序名称,您可以尝试作为一种解决方法(一种黑客)在运行时根据需要更改应用程序名称。
如果无法在FMX中更改应用程序名称,我担心目前无法更改通知标题。
然而,Mac OS X中的通知标题始终是推送它的应用程序名称,所以我认为这是在Mac OS X规范中定义的。