iOS开发:收到Game Center邀请时,如何获取GKMatch对象? [英] iOS Development: When receiving a Game Center invite, how do I obtain the GKMatch object?

查看:113
本文介绍了iOS开发:收到Game Center邀请时,如何获取GKMatch对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一款使用Game Center的iPhone游戏,我很难理解如何开始一场比赛游戏,该游戏是通过接收朋友的邀请来开始的。 docs 说这个......

I'm building an iPhone game that uses Game Center and I'm having a hard time understanding how to start a match game that was started by receiving an invitation to play from a friend. The docs say this...


当接受时,acceptedInvite参数为
非零应用程序直接从另一个
玩家收到
的邀请。在这种情况下,其他
玩家的应用程序已经在
创建了匹配请求,因此这个
的应用程序副本不需要
来创建一个。

The acceptedInvite parameter is non-nil when the application receives an invitation directly from another player. In this situation, the other player’s application has already created the match request, so this copy of your application does not need to create one.

根据这个,我不需要创建匹配请求,因为进行邀请的玩家已经创建了一个匹配请求。如果是这样,我如何获得向/从其他播放器发送/接收数据所需的GKMatch对象?我知道获取GKMatch对象的唯一方法是创建匹配请求并调用 findMatchForRequest 方法,文档说我不应该这样做。

According to this, I don't need to create a match request since the player who did the inviting already created one. If so, how do I obtain the GKMatch object needed to send/receive data to/from the other player? The only way that I know to get the GKMatch object is to create a match request and call the findMatchForRequest method, which the docs are saying I shouldn't do.

他们唯一的代码示例涉及创建和使用 GKMatchmakerViewController ,我不能使用它,因为我是创建我自己的自定义视图。

The only code example they have for this involves creating and using the GKMatchmakerViewController, which I can't use since I'm creating my own custom views.

非常感谢您的智慧!

推荐答案

我收到了一位Apple工程师对此的回复,这是他说的......

I received a response from one of the Apple engineers on this, here's what he said...


你可以自动执行与自定义的
视图匹配,但是没有使用
GKMatchmakerViewController就无法使用
邀请。所以你
应该遵循代码示例。

You can do auto-matching with custom views, but there is no way to use invites without using GKMatchmakerViewController. So you should follow the code sample.

我想这只是一致性的根本性突破我的用户界面。

I guess there's just going to have to be a radical break in the consistency of my UI.

这篇关于iOS开发:收到Game Center邀请时,如何获取GKMatch对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆