这是我的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的tutorial尝试这样做:
但是,即使是matchmakerviewcontroller也没有出现。我不知道我在做什么错。
提前致谢。
最佳答案
您是否在使用两个不同的游戏中心ID-一个用于模拟器,另一个用于设备?
您的设备是否已登录游戏中心沙箱?
模拟器将使用游戏中心沙箱,并且您的设备还必须使用沙箱将两者连接。
您可以通过退出游戏中心来登录游戏中心沙箱,然后启动您的应用程序。您的应用程序应要求您登录游戏中心。通过未发布的应用程序执行登录将使您进入游戏中心沙箱。
关于objective-c - Gamecenter对接无效,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12282043/