2

我在这里学习教程。多人游戏 iOS

我正在使用上面教程中的以下代码进行匹配

GKMatchRequest *request = [[[GKMatchRequest alloc] init] autorelease]; 
request.minPlayers = minPlayers;     
request.maxPlayers = maxPlayers;
request.playersToInvite = pendingPlayersToInvite;

GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithMatchRequest:request] autorelease];    
mmvc.matchmakerDelegate = self;

[presentingViewController presentModalViewController:mmvc animated:YES];

当我使用“立即播放”选项搜索其他玩家时,GKMatchmakerViewController立即被解雇matchmakerViewController:didFailWithError并出现以下错误。

Error Domain=GKErrorDomain Code=3 "The requested operation could not be 
completed due to an error communicating with the server." UserInfo=0x2081d8d0
{GKServerStatusCode=5001, NSUnderlyingError=0x2086c560 "The operation couldn’t be 
completed. (GKServerErrorDomain error 5001.)", NSLocalizedDescription=The requested
operation could not be completed due to an error communicating with the server.}

我一直无法弄清楚为什么会这样。相同的代码之前能够搜索和找到合适的玩家,但在使用获取玩家别名时失败了

[GKPlayer loadPlayersForIdentifiers:match.playerIDs withCompletionHandler:^(NSArray *players, NSError *error)

出现“无法与服务器通信”错误。

但是,该代码在模拟器上运行良好。

4

2 回答 2

3

我也得到了

错误域=GKErrorDomain 代码=3 “由于与服务器通信时出错,请求的操作无法完成。” UserInfo=0x17007e4c0 {GKServerStatusCode=5001, NSLocalizedDescription=由于与服务器通信错误,请求的操作无法完成,NSUnderlyingError=0x170050140 "操作无法完成。(GKServerErrorDomain 错误 5001。)

我认为这是 sandbox.gc.apple.com 问题.. 这个问题是一年,但苹果在某个时候仍然有这个问题

希望苹果尽快解决这个问题。

我在 iPod touch 上试了试,我得到了

错误域=NSURLErrorDomain 代码=-1001 “请求超时。” UserInfo=0x176bec90 {NSErrorFailingURLKey= http://sandbox.gc.apple.com/WebObjects/GKInit.woa/wa/getBag?ix=1,NSErrorFailingURLStringKey= http://sandbox.gc.apple.com/WebObjects/GKInit 。 woa/wa/getBag?ix=1 , NSLocalizedDescription=请求超时。}

于 2014-03-07T13:04:29.073 回答
1

使用reportScoreWithCompletionHandler 发送新的高分时遇到同样的问题(GKServerStatusCode=5001)。

在沙盒模式下一切正常,但 AppStore 版本在所有启用了沙盒模式的设备(iOS 8.2 / 8.3)上都有这个问题。但我可以在排行榜中看到其他用户的数据。看起来这实际上是Apple方面的错误。

于 2015-05-01T08:57:23.593 回答