iOS doesn't work when I add UseLocalNotification() to builder
Describe the bug My app is crashing when I add UseLocalNotification() function to builder in MauiProgram class.
To Reproduce Steps to reproduce the behavior:
-
Create project.
-
Add UseLocalNotification() function to builder in MauiProgram class. public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); }).UseLocalNotification();
return builder.Build();}
-
Run app.
-
The application won't start.
Screenshots

Platform (please complete the following information):
- OS: iOS
- Version 15.5
Smartphone (please complete the following information):
- Device: iPhone 12 iOS 15.5
- OS: iOS
- Version 15.5
@zuzannaczaja
can try below and remove UseLocalNotification();
public partial class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
LocalNotificationCenter.RequestNotificationPermissionAsync().GetAwaiter().GetResult();
return base.FinishedLaunching(app, options);
}
public override void WillEnterForeground(UIApplication uiApplication)
{
LocalNotificationCenter.RequestNotificationPermissionAsync().GetAwaiter().GetResult();
base.WillEnterForeground(uiApplication);
}
}
@zuzannaczaja
can try below and remove UseLocalNotification();
public partial class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); public override bool FinishedLaunching(UIApplication app, NSDictionary options) { LocalNotificationCenter.RequestNotificationPermissionAsync().GetAwaiter().GetResult(); return base.FinishedLaunching(app, options); } public override void WillEnterForeground(UIApplication uiApplication) { LocalNotificationCenter.RequestNotificationPermissionAsync().GetAwaiter().GetResult(); base.WillEnterForeground(uiApplication); } }
@thudugala Then there is the same problem
I do not have access to mac now. Will be able to help debug the issue
is so try
public partial class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
public override async bool FinishedLaunching(UIApplication app, NSDictionary options)
{
await LocalNotificationCenter.RequestNotificationPermissionAsync();
return base.FinishedLaunching(app, options);
}
public override async void WillEnterForeground(UIApplication uiApplication)
{
await LocalNotificationCenter.RequestNotificationPermissionAsync();
base.WillEnterForeground(uiApplication);
}
}
I do not have access to mac now. Will be able to help debug the issue
is so try
public partial class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); public override async bool FinishedLaunching(UIApplication app, NSDictionary options) { await LocalNotificationCenter.RequestNotificationPermissionAsync(); return base.FinishedLaunching(app, options); } public override async void WillEnterForeground(UIApplication uiApplication) { await LocalNotificationCenter.RequestNotificationPermissionAsync(); base.WillEnterForeground(uiApplication); } }
This code doesn't work

I changed for this (without async and await) public override bool FinishedLaunching(UIApplication app, NSDictionary options) { LocalNotificationCenter.RequestNotificationPermissionAsync();
return base.FinishedLaunching(app, options);
}
public override async void WillEnterForeground(UIApplication uiApplication)
{
await LocalNotificationCenter.RequestNotificationPermissionAsync();
base.WillEnterForeground(uiApplication);
}
but It doesn't work either
@mphill will you be able to help?
I have exactly the same issue, and the workarounds listed above don't work. I hope to see a fix soon, thanks :)
@Hashemalrifai @zuzannaczaja Please try version 10.0.2
@Hashemalrifai @zuzannaczaja Please try version 10.0.2
I encountered the same issue. Updating to version 10.0.2 fixes the issue, but the notification doesn't appear at all on the iOS emulator. However, it does work on the Android emulator.
@constantinginga
can try below and remove UseLocalNotification();
public partial class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
LocalNotificationCenter.RequestNotificationPermission();
return base.FinishedLaunching(app, options);
}
public override void WillEnterForeground(UIApplication uiApplication)
{
LocalNotificationCenter.ResetApplicationIconBadgeNumber(uiApplication);
base.WillEnterForeground(uiApplication);
}
}
@constantinginga
can try below and remove UseLocalNotification();
public partial class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); public override bool FinishedLaunching(UIApplication app, NSDictionary options) { LocalNotificationCenter.RequestNotificationPermission(); return base.FinishedLaunching(app, options); } public override void WillEnterForeground(UIApplication uiApplication) { LocalNotificationCenter.ResetApplicationIconBadgeNumber(uiApplication); base.WillEnterForeground(uiApplication); } }
Doesn't seem to work, the notification still doesn't show up.
@constantinginga can try below and remove UseLocalNotification();
public partial class AppDelegate : MauiUIApplicationDelegate { protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); public override bool FinishedLaunching(UIApplication app, NSDictionary options) { LocalNotificationCenter.RequestNotificationPermission(); return base.FinishedLaunching(app, options); } public override void WillEnterForeground(UIApplication uiApplication) { LocalNotificationCenter.ResetApplicationIconBadgeNumber(uiApplication); base.WillEnterForeground(uiApplication); } }Doesn't seem to work, the notification still doesn't show up.
I have the same problem.
Still not fixed?
Try version 10.0.3