Skip to content

Commit

Permalink
fix iOS Game.Services NullReferenceException (#1607)
Browse files Browse the repository at this point in the history
fixes #1596
  • Loading branch information
nkast authored May 25, 2024
1 parent 3921881 commit aa3901f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MonoGame.Framework/.iOS/ConcreteGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ConcreteGame(Game game) : base(game)
{
ConcreteGame._concreteGameInstance = this;

game.Services.AddService(typeof(ConcreteGame), this);
this.Services.AddService(typeof(ConcreteGame), this);

string appLocation = ((ITitleContainer)TitleContainer.Current).Location;
Directory.SetCurrentDirectory(appLocation);
Expand All @@ -51,10 +51,10 @@ public ConcreteGame(Game game) : base(game)
_uiWindow = new UIWindow(UIScreen.MainScreen.Bounds);
//_uiWindow.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

game.Services.AddService(typeof(UIWindow), _uiWindow);
this.Services.AddService(typeof(UIWindow), _uiWindow);

_viewController = new iOSGameViewController(this);
game.Services.AddService(typeof(UIViewController), _viewController);
this.Services.AddService(typeof(UIViewController), _viewController);

_gameWindow = new iOSGameWindow(_viewController);
base.Window = _gameWindow;
Expand Down

0 comments on commit aa3901f

Please sign in to comment.