【发布时间】:2017-04-28 04:09:58
【问题描述】:
我的应用程序具有多人模式,我正在使用以下代码来查找玩家:
[GKMatch ] GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 4;
[[GKMatchmaker sharedMatchmaker] findMatchForRequest:request withCompletionHandler:^(GKMatch *match, NSError *error) {
if (error)
{
// Process the error.
NSLog(@"Error Match Process: %@", error);
}
else if (match != nil)
{
DuelModeController* duelModeController = (DuelModeController*)viewController;
[duelModeController updateSearchingMessageWith:@" Connecting Game..."];
}
}];
上面的代码有效。问题是找到一个玩家非常慢,最多需要 12 到 15 秒。为了测试它,我正在使用具有两个不同游戏中心帐户的 iPhone 和 iPad,两者都有 IOS 10.2。
您会遇到这种情况吗?您是如何解决的?
谢谢
【问题讨论】:
标签: ios objective-c game-center multiplayer