Iphone 游戏中心不可用玩家未登录
在iOS 6上,当玩家未登录并尝试使用GameCenter时,会弹出一个UIAlertView,其中包含我在标题中输入的文本。“游戏中心不可用,玩家未登录”。我的问题是,是否可以用我自己的接口元素替换UIAlertViewIphone 游戏中心不可用玩家未登录,iphone,ios6,game-center,Iphone,Ios6,Game Center,在iOS 6上,当玩家未登录并尝试使用GameCenter时,会弹出一个UIAlertView,其中包含我在标题中输入的文本。“游戏中心不可用,玩家未登录”。我的问题是,是否可以用我自己的接口元素替换UIAlertView [GKLocalPlayer localPlayer].authenticateHandler = ^(UIViewController *viewController, NSError *error) { if
[GKLocalPlayer localPlayer].authenticateHandler = ^(UIViewController *viewController, NSError *error)
{
if ([[GKLocalPlayer localPlayer] isAuthenticated])
{
NSLog(@"[gamecenter] player authenticated: %@\n", [GKLocalPlayer localPlayer]);
[self gamecenterLoadAchievements];
[GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite *acceptedInvite, NSArray *playersToInvite)
{
// Insert application-specific code here to clean up any games in progress.
if (acceptedInvite)
{
NSLog(@"Accepted invitation");
isInvited = YES;
[[GameLevel sharedGameLevel] setCurrentGameMode:GameModeGameCenter];
GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithInvite:acceptedInvite] autorelease];
mmvc.matchmakerDelegate = self;
AppDelegate * delegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
[delegate.viewController presentModalViewController:mmvc animated:YES];
}
else if (playersToInvite)
{
NSLog(@"Players to invite");
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;
[presentingViewController presentModalViewController:mmvc animated:YES];
}
};
}
else
if (viewController)
{
AppDelegate *delegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
NavigationController *_viewController = delegate.viewController.navController;
[_viewController presentViewController: viewController animated: YES completion:nil];
}
else
{
NSLog(@"[gamecenter] %@\n", error);
gcLoginFailed = YES;
if ([[error domain] isEqualToString:GKErrorDomain])
{
if ([error code] == GKErrorNotSupported)
gcIsSupported = NO;
else
if ([error code] == GKErrorCancelled)
gcLoginCancelled = YES;
}
}
};
只是不要使用UIAlertView使用您自己的图形和UIButton 如果在身份验证中使用disableGameCenter方法,请不要使用它,而是使用整型int-isPlayerSignedIn。然后将其返回到1或0。所以,
if (isPlayerSignedIn==0) {
//display your graphics
}
else do nothing .
编辑:
else
if (viewController)
{
AppDelegate *delegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
NavigationController *_viewController = delegate.viewController.navController;
[_viewController presentViewController: viewController animated: YES completion:nil];
}
如果您不使用这些代码行,您将看到您没有获得UIAlertView
然后你可以实现一个“游戏中心不可用”的工作人员,但另外你还必须实现一个登录屏幕 真的吗?我如何访问该UIAlertView以用我自己的图形替换它?如果你发布身份验证代码,我可以说一些话,你的排行榜代码你是在创建UIAlertView还是在创建系统?GameKit正在这样做,难道我不能理解如何处理我启动的UIAlertView吗?只要你发布一个代码,特别是验证代码,我就会写下要更改的内容,或者如果它不能更改