Reputation: 15414
I've pulled the following code from Embarcadero site (here) to generate a local notification.
procedure TForm1.SetNumberClick(Sender: TObject);
var
MyNotification: TNotification;
begin
// Create an instance of TNotification
MyNotification := NotificationCenter1.CreateNotification;
try
MyNotification.Number :=18;
MyNotification.AlertBody := 'Delphi for your mobile device is here!';
NotificationCenter1.PresentNotification(MyNotification);
finally
MyNotification.DisposeOf;
end;
end;
It compiles and runs. As expected, I did have to create NotificationCenter1 as a TNotificationCenter on my form. It works find under Android, but under iOS I get butkus. No local notification, no count on the icon, not even an error.
Did it ever work under XE8?
Has something changed with respect to local notification between XE8 and 10/Seattle?
My phone is running iOS 9.2. Did something change in iOS between 8.x and 9.x that breaks local notifications for Firemonkey?
Upvotes: 0
Views: 1675
Reputation: 15414
The ultimate solution was two fold:
FMLocalNotificationPermission
set to true (Project
-> Options -> Version Info) Upvotes: 1
Reputation: 38743
I've followed the tutorial before, and it works.
There are also two sample apps that ship with with 10 Seattle.
I just tried both of these on iOS 9.2 with Delphi 10 Seattle Update 1, and they worked as expected for me. (Also worked in XE8). Your code looks correct as well.
Maybe at some point you told iOS not to show you notifications. Did you check in application settings?
Upvotes: 1