关于playersToInvite的确切答案 [英] Definitive answer to what playersToInvite is for

查看:109
本文介绍了关于playersToInvite的确切答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Game Center文档指示

The Game Center documentation indicates that the

playersToInvite参数为非零 当您的应用程序启动时 直接从游戏中心 举办比赛的申请.

playersToInvite parameter is non-nil when your application is launched directly from the Game Center application to host a match.

有人问这是如何工作的,即似乎没有办法从Game Center应用程序中选择一个朋友并邀请他们从Game Center中玩;仅当您邀请游戏中的玩家时才有效.该文档是否过时或是否有秘密方法可以从Game Center中进行特定于游戏的比赛?我想测试inviteHandler,但无法确定如何将此参数传递给应用程序.

A few people have asked how this works exactly, i.e. there doesn't appear to be a way to select a friend from the Game Center application and invite them to play from Game Center; it only works when you invite in-game. Is this documentation dated or is there a secret way to start a game-specific match from Game Center? I'd like to test my inviteHandler but I've been unable to determine how this parameter is passed to the application.

[GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite *acceptedInvite, NSArray *playersToInvite)
{
    // clean up games in progress here
    if (acceptedInvite)
    {
        NSLog(@"acceptedInvite %@", acceptedInvite);
        // The acceptedInvite parameter is non-nil when the application receives an 
        // invitation directly from another player.
        GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithInvite:acceptedInvite] autorelease];
        mmvc.matchmakerDelegate = self;
        [self disableHomeUI];
        [self presentModalViewController:mmvc animated:YES];
    }
    else if (playersToInvite)
    {
        NSLog(@"playersToInvite %@", playersToInvite);
        // playersToInvite parameter is non-nil when your application is launched 
        // directly from the Game Center application to host a match
        [self disableHomeUI];
        [self doPresentMatchMakerUIWithPlayersToInvite:playersToInvite];
    }
};

推荐答案

在将我的应用程序Cee-lo投入生产后,playersToInvite代码变为活动状态.这似乎是因为Game Center应用本身的沙盒版本不允许您从那里开始与玩家一起玩游戏,而正式版本则可以.如果您问我,那不是一个很好的测试环境!

After launching my application Cee-lo into production, the playersToInvite code became active. This seems to be because the Sandbox version of the Game Center app itself does not allow you to start a game with a player from there, but the production version does. Not a very good test environment if you ask me!

这篇关于关于playersToInvite的确切答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆