1

这是我的 Menu.m 的 onEnter 方法:

GKMatchRequest *request = [[[GKMatchRequest alloc] init] autorelease];
request.minPlayers = 2;
request.maxPlayers = 2;
GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithMatchRequest:request] autorelease];
mmvc.matchmakerDelegate = self;

tempVC = [[UIViewController alloc] init];
[[[CCDirector sharedDirector] view] addSubview:tempVC.view];
[tempVC presentModalViewController: mmvc animated: NO];
mmvc.view.frame = CGRectMake(150, 150, 510, 420);

我尝试使用设备和模拟器,但它们无法匹配。

我还尝试按照 Ray Wenderlich 的教程进行操作:

但是后来,连matchmakerviewcontroller都没有出现。我不知道我做错了什么。

提前致谢。

4

1 回答 1

3

您是否使用了两个不同的游戏中心 ID——一个用于您的模拟器,一个用于您的设备?

您的设备是否已登录游戏中心沙盒?

模拟器将使用游戏中心沙箱,您的设备也必须使用沙箱才能使两者连接。

您可以通过退出游戏中心,然后启动您的应用程序来登录游戏中心沙盒。您的应用程序应该要求您登录游戏中心。通过您未发布的应用程序执行登录将使您进入游戏中心沙箱。

于 2012-09-05T21:24:09.250 回答