使用monogame构建默认iOS解决方案时出现错误消息

前端之家收集整理的这篇文章主要介绍了使用monogame构建默认iOS解决方案时出现错误消息前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试在Monotouch上构建默认的“MonoGame.Framework.iOS.sln”时,有谁知道为什么我收到以下错误消息?我怎么解决这个问题? :

指南源文件的第468行(来自MonoGame.Framework.iOS> iOS> GamerServices> Guide.cs
我明白了

public static void ShowMatchMaker()
{
     AssertInitialised ();

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

//该行上的错误是 – 类型’MonoTouch.GameKit.GKMatchmakerViewController’不包含带有’0’参数的构造函数.

解决方法

默认构造函数(实际上是GKMatchmakerViewController类型的init选择器)无效(遗憾的是,关于可以使用init初始化的内容的Apple文档有点缺乏).

同样从iOS6开始,这会在运行时抛出一个ObjectiveC异常:

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

因此,这个默认构造函数以及其他一些构造函数删除,因为它们的使用可能会导致早期iOS版本中出现奇怪的崩溃(并且你不希望你的游戏在iOS6上行为不端).

猜你在找的iOS相关文章