iosxamarin.iosgamekitmonogamegkmatchmaker

Error message when building default iOS solution in with monogame


Does anybody know why I get the following error message when I try to build the default "MonoGame.Framework.iOS.sln" on Monotouch? And how I can fix this? :

on line 468 of the Guide source file (From MonoGame.Framework.iOS>iOS>GamerServices>Guide.cs I get,

public static void ShowMatchMaker()
{
     AssertInitialised ();

if ( ( Gamer.SignedInGamers.Count > 0 ) && ( Gamer.SignedInGamers[0].IsSignedInToLive ) )
   {
    // Lazy load it
if ( matchmakerViewController == null )
   {
     matchmakerViewController = new GKMatchmakerViewController(); }

// error on that line is-- type 'MonoTouch.GameKit.GKMatchmakerViewController' does not contain a constructor that takes '0' arguments.


Solution

  • The default constructor (actually the init selector for the GKMatchmakerViewController type) was invalid (sadly Apple documentation on what can be initialized with init is a bit lacking).

    Also starting with iOS6 this would throws an ObjectiveC exception at runtime:

    Objective-C exception thrown.  
    Name: NSInvalidArgumentException 
    Reason: <GKMatchmakerViewController: 0x16101160>: 
    must use one of the designated initializers
    

    As such this default constructor, along with a few others, were removed since their use could cause weird crashes in earlier iOS releases (and you do not want your game to misbehave on iOS6 anyway).