title: Xamarin Studio: System.InvalidOperationException
body: <p>I created a new MonoGame iOS solution in Xamarin Studio. After that, I added to following code to Game1.cs:</p>
  
  <pre><code>bool IsiOS = false;    
  if (Device.RuntimePlatform == Device.iOS)
     IsiOS = true;
  </code></pre>
  
  <p>But I get an error message when I build the project. </p>
  
  <pre><code>if (Device.RuntimePlatform == Device.iOS)
  </code></pre>
  
  <blockquote>
    <p>System.InvalidOperationException  You MUST call Xamarin.Forms.Init();
    prior to using it.</p>
  </blockquote>
  
  <p>What is wrong with my code? I don't know what I should add or change.</p>
  
  <p>code(Game1.cs):</p>
  
  <pre><code>using System;
  using Microsoft.Xna.Framework;
  using Microsoft.Xna.Framework.Graphics;
  using Microsoft.Xna.Framework.Input;
  using Xamarin.Forms;
  
  namespace NewTest.iOS
  {
  public class Game1 : Game
  {
      GraphicsDeviceManager graphics;
      SpriteBatch spriteBatch;
      bool IsiOS = false;
  
      public Game1()
      {
          graphics = new GraphicsDeviceManager(this);
          Content.RootDirectory = "Content";
          graphics.IsFullScreen = true;
      }
  
      protected override void Initialize()
      {  
          base.Initialize();
      }
  
      protected override void LoadContent()
      {
          spriteBatch = new SpriteBatch(GraphicsDevice);
          if (Device.RuntimePlatform == Device.iOS)
              IsiOS = true;
      }
  
      protected override void Update(GameTime gameTime)
      {
          base.Update(gameTime);
      }
  
      protected override void Draw(GameTime gameTime)
      {
          graphics.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.CornflowerBlue);
  
          base.Draw(gameTime);
      }
  }
  }
  </code></pre>
  
  <p>code(Program.cs):</p>
  
  <pre><code>using System;
  using Foundation;
  using UIKit;
  
  namespace NewTest.iOS
  {
  [Register("AppDelegate")]
  class Program : UIApplicationDelegate
  {
      private static Game1 game;
  
      internal static void RunGame()
      {
          game = new Game1();
          game.Run();
      }
  
      static void Main(string[] args)
      {
          UIApplication.Main(args, null, "AppDelegate");
      }
  
      public override void FinishedLaunching(UIApplication app)
      {
          RunGame();
      }
  }
  }
  </code></pre>