我在提交之前进行了测试,当然它在iOS 6上的模拟器上工作,但在5.1上它不会工作,因为expectedPlayerCount总是出现1而不是0!就在5.1 !!我搜索了问题,开发人员说它的网络问题和沙箱问题,所以我提交了我的应用程序,它得到了批准!现在我尝试了它,它始终坚持连接!
- (void)findMatchWithMinPlayers:(int)minPlayers maxPlayers:(int)maxPlayers viewController:(UIViewController *)viewController委托:(id)theDelegate {
if(!gameCenterAvailable)返回;
matchStarted = NO; self.match = nil; self.presentingViewController = viewController; delegate = theDelegate;
if(pendingInvite!= nil){
[presentingViewController dismissModalViewControllerAnimated:NO];
NSLog(@"findmatch");
GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithInvite:pendingInvite] ;
mmvc.matchmakerDelegate = self;
[presentingViewController presentModalViewController:mmvc animated:YES];
self.pendingInvite = nil;
self.pendingPlayersToInvite = nil;
} else {
[presentingViewController dismissModalViewControllerAnimated:NO];
NSLog(@"findmatch2");
GKMatchRequest *request = [[GKMatchRequest alloc] init] ;
request.minPlayers = minPlayers;
request.maxPlayers = maxPlayers;
request.playersToInvite = pendingPlayersToInvite;
GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithMatchRequest:request];
mmvc.matchmakerDelegate = self;
[presentingViewController presentModalViewController:mmvc animated:YES];
self.pendingInvite = nil;
self.pendingPlayersToInvite = nil;
}
}
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)theMatch {NSLog(@ "%d",theMatch.expectedPlayerCount); [presentingViewController dismissModalViewControllerAnimated:YES]; NSLog(@ "didfind"); self.match = theMatch; NSLog(@ "%d",match.expectedPlayerCount); match.delegate = self; if(!matchStarted && match.expectedPlayerCount == 0){NSLog(@ "Ready to start match!"); [self lookupPlayers]; }}
请帮助我得到这么多差评!
1 回答
可能为时已晚,无法帮助您,但您确定已在iTunes Connect的两个位置启用了Game Center吗?这篇文章:https://devforums.apple.com/thread/66773?tstart=0
告诉您在管理游戏中心部分和您要上传的版本中启用(否则它可能在沙箱中工作但不在应用商店中)
希望能帮助到你!