Nicks
Nicks

Reputation: 25

How to remove duplicate devices in bluetooth connection using GKPeerPickerController in ios

I want to connect two ios devices via bluetooth using GKPeerPickerController. At the first time, it connects well but after that there is a problem in connction on can't connected.

There are duplicate devices listing in GKPeerPickerController alert while searching near by devices. Please help me.

I am using following code to search nearby devices via bluetooth.

#pragma mark - GameKit Peer Picker
-(void)startSearch { GKPeerPickerController *picker = [[GKPeerPickerController alloc] init]; picker.delegate = self; [picker show]; }

-(void)peerPickerControllerDidCancel:(GKPeerPickerController *)picker{picker.delegate = nil;}

-(GKSession *)peerPickerController:(GKPeerPickerController *)picker sessionForConnectionType:(GKPeerPickerConnectionType)type {
   NSString *sessionIDString = @"MTBluetoothSessionID";
  return [[GKSession alloc] initWithSessionID:sessionIDString displayName:nil sessionMode:GKSessionModePeer]; 
}

-(void)peerPickerController:(GKPeerPickerController *)picker didConnectPeer:(NSString *)peerID toSession:(GKSession *)session {}

Upvotes: 1

Views: 487

Answers (0)

Related Questions