【发布时间】:2011-03-10 04:34:52
【问题描述】:
根据文档,我正在使用:
- (void) match:(GKMatch*) match
player:(NSString*) playerID
didChangeState:(GKPlayerConnectionState) state;
进行初始游戏协商。我这样做的范围是:
if (matchStarted_ == NO && [match expectedPlayerCount] == 0) { ... }
我需要决定哪个设备负责设置游戏。为此,我对match.playerIDs NSArray 实例进行排序,并将[GKLocalPlayer localPlayer].playerID NSString 与排序数组索引0 处的playerID NSString 进行比较。该玩家创建游戏,将数据发送给所有玩家。
但是,即使 expectedPlayerCount 为 0,playerIDs 数组此时也有零条目,这给了我一个数组溢出。这是为什么?而我应该怎么做才能明确选择玩家来生成游戏?
【问题讨论】:
标签: iphone game-center