MatchmakingServerというクラスには、次のようなメソッドがあります。
- (void)session:(GKSession *)session peer:(NSString *)peerID didChangeState:(GKPeerConnectionState)state
{{
switch (state)
{
case GKPeerStateAvailable:
break;
case GKPeerStateUnavailable:
break;
// A new client has connected to the server.
case GKPeerStateConnected:
if (_serverState == ServerStateAcceptingConnections)
{
if (![_connectedClients containsObject:peerID])
{
NSString *peerID2 =[self displayNameForPeerID:peerID];
self.PeerId=peerID;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops:("
message:[NSString stringWithFormat:@"%@:%@ %@",@"device",peerID2,@"want to join your session"]
delegate:self
cancelButtonTitle:@"NO"
otherButtonTitles:nil];
[_connectedClients addObject:peerID];
NSLog(@"the orginal peerID %@",peerID);
[self.delegate matchmakingServer:self clientDidConnect:peerID];
}
}
また
@interface MatchmakingServer : NSObject <GKSessionDelegate,UIAlertViewDelegate>
alertViewがclickedButtonAtIndexを呼び出さない理由に関するアイデア