저는 멀티 플레이어 경기를 허용하는 게임을 개발해 왔습니다. 이전에 멀티 플레이어 초대장을 테스트 한 결과 모두 작동했습니다. 한 장치에서 요청을 보내면 다른 장치에 배너가 표시되고 초대가 수락되면 게임이 시작되었습니다.게임 센터 초대장이 표시되지 않습니다.
이틀 전에 앱을 제출하기 바로 전에이 기능을 다시 테스트하여 작동이 중지되었음을 확인했습니다.
2013-03-27 18:06:20.112 MyApp[791:907] Authentication changed: player authenticated.
2013-03-27 18:06:21.219 MyApp[791:907] Invite handler installed
Mar 27 18:06:21 Neils-iPhone MyApp[791] <Notice>: 18:06:21.356712 com.apple.GameKitServices: -[GKDiscoveryManager startAdvertisingLocalPlayer:discoveryInfo:]: I am [<nil>] [7989F444CF2BDA83] discoveryInfo [{
e = 2;
h = A42FD7FD;
}]
인 "I 나는 [] ..."위의 라인에 상당한 :
- (void)authenticateLocalUser:(UIViewController *)viewController :(id<GCHelperDelegate>)theDelegate
{
delegate = theDelegate;
self.presentingViewController = viewController;
if (!gameCenterAvailable) {
// Game Center is not available.
userAuthenticated = FALSE;
}
else{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
/*
The authenticateWithCompletionHandler method is like all completion handler methods and runs a block
of code after completing its task. The difference with this method is that it does not release the
completion handler after calling it. Whenever your application returns to the foreground after
running in the background, Game Kit re-authenticates the user and calls the retained completion
handler. This means the authenticateWithCompletionHandler: method only needs to be called once each
time your application is launched. This is the reason the sample authenticates in the application
delegate's application:didFinishLaunchingWithOptions: method instead of in the view controller's
viewDidLoad method.
Remember this call returns immediately, before the user is authenticated. This is because it uses
Grand Central Dispatch to call the block asynchronously once authentication completes.
*/
//ios 6
[localPlayer setAuthenticateHandler:(^(UIViewController* viewcontroller, NSError *error) {
if (viewcontroller != nil){
userAuthenticated = FALSE;
[self.presentingViewController presentViewController: viewcontroller animated: YES completion:nil];
}
else if (localPlayer.isAuthenticated){
// Enable Game Center Functionality
userAuthenticated = TRUE;
[self checkForInvite:self.presentingViewController :delegate];
if (! self.currentPlayerID || ! [self.currentPlayerID isEqualToString:localPlayer.playerID]) {
// Current playerID has changed. Create/Load a game state around the new user.
self.currentPlayerID = localPlayer.playerID;
// get friends of local player
[localPlayer loadFriendsWithCompletionHandler:^(NSArray *friends, NSError *error) {
if (friends != nil)
{
[self loadPlayerData: friends];
}
}];
}
}
else{
userAuthenticated = FALSE;
}
[scoreHandler setGameCentreAvailable:userAuthenticated];
})];
}
}
- (void)checkForInvite :(UIViewController *)viewController :(id<GCHelperDelegate>)theDelegate
{
delegate = theDelegate;
self.presentingViewController = viewController;
NSLog(@"Invite handler installed");
[GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite *acceptedInvite, NSArray *playersToInvite) {
// Insert application-specific code here to clean up any games in progress.
if (acceptedInvite){
NSLog(@"Accepted");
GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithInvite:acceptedInvite] autorelease];
mmvc.matchmakerDelegate = self;
[viewController presentViewController: mmvc animated: YES completion:nil];
} else if (playersToInvite) {
NSLog(@"Match Request");
GKMatchRequest *request = [[[GKMatchRequest alloc] init] autorelease];
request.minPlayers = 2;
request.maxPlayers = 2;
request.playersToInvite = playersToInvite;
GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithMatchRequest:request] autorelease];
mmvc.matchmakerDelegate = self;
[viewController presentViewController: mmvc animated: YES completion:nil];
}
};
}
엑스 코드의 디버그 창에 다음을 보여줍니다?
나는 멀티 플레이어 게임을 제작 한 Ray Wenderlich의 사이트에서 자습서를 다운로드하여 실행 해 보았습니다. 두 장치에서 포 그라운드에서 실행 중이 아니면 동일한 문제가 나타납니다. 전경에서 실행중인 경우에도 내 앱에 초대 요청이 표시되지 않습니다.
다른 누구도이 문제가 발생했는지 또는 어떤 일이 벌어지고 있는지 아이디어가 있습니까? authenticateLocalUser는 내가 초대별로 이름 작품을 만들 수