0
    -(void) TimerMethod {
      [session disconnectFromAllPeers];
      timer = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(myMethod) userInfo:nil repeats:YES];    
    }

    -(void)myMethod {
      @try {
        GKSession *session1=[[GKSession alloc] initWithSessionID:nil displayName:nil sessionMode: GKSessionModePeer];
        self.session=session1;
        session.disconnectTimeout=6.0;
        [session setDataReceiveHandler:self withContext:nil];
        session.delegate=self;
        session.available=YES; 
      }    
      @catch (NSException * e) {
        //NSLog(@"Exception occured");
        [session disconnectFromAllPeers];
        session=NULL;
        GKSession *session1=[[GKSession alloc] initWithSessionID:nil displayName:nil sessionMode: GKSessionModePeer];    
      }    
    }

Now it will search for devices, but I want to make array of these devices, and sorry to say "Don't suggest me GKRocket, please".

Matteo Alessani
  • 10,264
  • 4
  • 40
  • 57
Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154

1 Answers1

0
NSMutableArray *availablePeers = [[self.session peersWithConnectionState:GKPeerStateAvailable] mutableCopy];
Marco
  • 6,692
  • 2
  • 27
  • 38