Note that there are some explanatory texts on larger screens.

plurals
  1. POGKPeerPickerController deprecated
    text
    copied!<p>I Have a Problem When I Use This Code GKPeerPickerController And GKSession And GKPeerConnectionState</p> <p>The Error I Got Is : GKPeerPickerController is deprecated : first deprecate in IOS 7</p> <p>My Code Is :</p> <blockquote> <pre><code>-(void) receiveData:(NSData *)data fromPeer:(NSString *)peer inSession:(GKSession *)session context:(void *)context { NSKeyedUnarchiver *archiver=[[NSKeyedUnarchiver alloc]initForReadingWithData:data]; NSString *str=[archiver decodeObjectForKey:@"Text"]; [self adicionarTexto:str fuiEu:NO]; } -(void)peerPickerController:(GKPeerPickerController *)picker didConnectPeer:(NSString *)peerID toSession:(GKSession *) session { currentSession = session; session.delegate = self; [session setDataReceiveHandler:self withContext:nil]; picker.delegate = nil; [picker dismiss]; } -(void)peerPickerControllerDidCancel:(GKPeerPickerController *)picker{ picker.delegate = nil; conectado=NO; } -(void)session:(GKSession *)session peer:(NSString *)peerID didChangeState:(GKPeerConnectionState)state { if (state==GKPeerStateConnected) { conectado=YES; </code></pre> </blockquote> <pre><code> }else{ conectado=NO; } [self atualizarBarra]; } </code></pre> <p>And</p> <pre><code> -(void)peerPickerController:(GKPeerPickerController *)picker didConnectPeer:(NSString *)peerID toSession:(GKSession *) session { currentSession = session; session.delegate = self; [session setDataReceiveHandler:self withContext:nil]; picker.delegate = nil; [picker dismiss]; } </code></pre> <p>And </p> <blockquote> <pre><code>-(void)conectar{ if (conectado==NO) { BTpicker = [[GKPeerPickerController alloc] init]; BTpicker.delegate = self; BTpicker.connectionTypesMask = GKPeerPickerConnectionTypeNearby; [BTpicker show]; }else { [currentSession disconnectFromAllPeers]; } } </code></pre> </blockquote> <p>Please I Need Help Fast :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload