Closed cris-m closed 7 months ago
Which exception? are you updated with MauiReactor?
System.NotImplementedException: Either set MainPage or override CreateWindow.
at Microsoft.Maui.Controls.Application.CreateWindow(IActivationState activationState)
at Microsoft.Maui.Controls.Application.Microsoft.Maui.IApplication.CreateWindow(IActivationState activationState)
at Microsoft.Maui.Platform.ApplicationExtensions.CreatePlatformWindow(IApplication application, UIWindowScene windowScene, NSDictionary[] states)
at Microsoft.Maui.Platform.ApplicationExtensions.CreatePlatformWindow(IUIApplicationDelegate platformApplication, IApplication application, UIApplication uiApplication, NSDictionary launchOptions)
That exception is thrown when MauiReactor encounters an error in rendering a component and can be caused by something else. Please provide a small app reproducing the issue so I can look into it.
FYI Trackizer app uses StatusBarBehavior as well, maybe you can take a look: https://github.com/adospace/mauireactor-samples/tree/main/TrackizerApp
Also, you can attach a callback to MauiReactor that is called when the exception is raised let you know exactly where it happened:
var builder = MauiApp.CreateBuilder();
...
builder.OnMauiReactorUnhandledException(ex => ....)
I have checked how it implemented in TrackizerApp. it execute well in Android
. The error is thrown when using iOS
. I have to add a condition to exclude iOS
.
public override VisualNode Render()
=> new ContentPage([
#if !IOS
new StatusBarBehavior()
.StatusBarColor(_statusBarColor)
.StatusBarStyle(Themes.IsDarkTheme ? StatusBarStyle.LightContent : StatusBarStyle.DarkContent)
#endif
]);
Is the iOS
issue related to reactorui-maui
or dotnet MAUI
?
hum, ok not sure why is not working on ios, probably I found it not working on ios and I've removed it, will look into it.
For the future please provide your environment ios/android etc as I usually use VisualStudio under windows with Android emulator.
let's keep the issue open for now
just found https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/behaviors/statusbar-behavior?tabs=ios
you have to set this under ios
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
let me know if it works
I am still getting an exception.
at CommunityToolkit.Maui.Core.Platform.StatusBar.UpdateStatusBarAppearance(UIWindow window)\n at CommunityToolkit.Maui.Core.Platform.StatusBar.PlatformSetColor(Color color)\n at CommunityToolkit.Maui.Core.Platform.StatusBar.SetColor(Color color)
ok, much probably this is why I've removed the ios target in Trackizer, I guess it's something related to the CommunityToolkit then
Okay. I will close the issue.
Is there a possibility to use
StatusBarBehavior
set the color and theme of the status bar? I tried the following and I am getting an exception.