ピアの新しい表示名を読み取るには、GKSession を強制終了して更新する必要があります。nil に設定して新たに開始しても機能しません。以下のコードでは、使用可能なピアを表示するfor ループの NSLog は呼び出されません (エラー メッセージはありません)。
-(IBAction) btnRefresh:(id) sender {
self.currentSession = nil;
self.currentSession = [[GKSession alloc] initWithSessionID:@"anything" displayName:name sessionMode:GKSessionModePeer];
self.currentSession.delegate = self;
self.currentSession.available = YES;
self.currentSession.disconnectTimeout = 0;
[self.currentSession setDataReceiveHandler:self withContext:nil];
peerListAvailable = [[NSMutableArray alloc] initWithArray:[currentSession peersWithConnectionState:GKPeerStateAvailable]];
for (NSString *peer in peerListAvailable) {
NSLog(@"found available peer; checking name and ID... %@, %@",[currentSession displayNameForPeer:peer], peer);
}
currentSession を nil に設定して新たに開始することの何が問題になっていますか? GKSession を更新する別の方法をご存知でしょうか? よろしくお願いします。