diff --git a/Rg.Plugins.Popup/Platforms/Mac/Impl/PopupPlatformMacOS.cs b/Rg.Plugins.Popup/Platforms/Mac/Impl/PopupPlatformMacOS.cs index 89ee52b9..7f0b8e0c 100644 --- a/Rg.Plugins.Popup/Platforms/Mac/Impl/PopupPlatformMacOS.cs +++ b/Rg.Plugins.Popup/Platforms/Mac/Impl/PopupPlatformMacOS.cs @@ -37,7 +37,8 @@ public Task AddAsync(PopupPage page) var renderer = page.GetOrCreateRenderer(); - NSApplication.SharedApplication.MainWindow.ContentView.AddSubview(renderer.NativeView); + var forcedMainWindow = NSApplication.SharedApplication.MainWindow ?? Application.Current.MainPage.GetOrCreateRenderer().NativeView.Window; + forcedMainWindow.ContentView.AddSubview(renderer.NativeView); return Task.CompletedTask; }