I have a class called MatchmakingServer has a method as following:
- (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];
}
}
also
@interface MatchmakingServer : NSObject <GKSessionDelegate,UIAlertViewDelegate>
Any Ideas why alertView dosn’t call the clickedButtonAtIndex
You’re not showing the alert view on the screen, you’re only initializing it. Insert
after the initialization code and you should be fine.