Protocol: GKPeerPickerControllerDelegate

Overview

The GKPeerPickerControllerDelegate protocol is implemented on an object to customize the behavior of a GKPeerPickerController object. The delegate is called by the peer picker to create a session object and to respond as the session is configured by the controller.Tells the delegate that the controller connected a peer to the session.Tells the delegate that the user selected a connection type.Asks the delegate to return a session for the specified connection type.Tells the delegate that the user canceled the connection attempt.

Instance Method Summary (collapse)

Instance Method Details

- (Object) peerPickerController(picker, didConnectPeer:peerID, toSession:session)

Tells the delegate that the controller connected a peer to the session. Once a peer is connected to the session, your application should take ownership of the session, dismiss the peer picker, and then use the session to communicate with the other peer.Important: Although optional in the protocol, Game Kit expects your application to implement this method.

Parameters:

  • picker (GKPeerPickerController)

    The controller that connected the peer.

  • peerID (String)

    The identification string for the peer that connected to the session.

  • session (GKSession)

    The session that the peer is connected to.

Returns:

- (Object) peerPickerController(picker, didSelectConnectionType:type)

Tells the delegate that the user selected a connection type. If the peer picker is configured to allow users to choose between multiple connection types, this method is called when users select the connection type they want to use. Your delegate implements this method if you want to override the behavior for a particular connection type.Important: In iOS 3.0, the peer picker can configure Bluetooth connections (GKPeerPickerConnectionTypeNearby). If the user chooses an Internet connection (GKPeerPickerConnectionTypeOnline), your delegate should dismiss the dialog and present its own user interface to configure the Internet connection:

Parameters:

  • picker (GKPeerPickerController)

    The controller for the peer picker dialog.

  • type (GKPeerPickerConnectionType)

    The type of network connection chosen by the user.

Returns:

- (GKSession) peerPickerController(picker, sessionForConnectionType:type)

Asks the delegate to return a session for the specified connection type. Your delegate is responsible for providing a GKSession to use to find and connect to other devices. When the peer picker needs a session, it calls this method. Your application can either create a new session or return a previously created session to the peer picker. The session that your application returns to the peer picker must advertise itself as a peer (GKSessionModePeer).If your delegate does not implement this method and the user selected a network of type GKPeerPickerConnectionTypeNearby, the peer controller allocates a new session that advertises itself as a peer (GKSessionModePeer) with the default sessionID and displayName parameters.

Parameters:

  • picker (GKPeerPickerController)

    The controller requesting the session.

  • type (GKPeerPickerConnectionType)

    The type of connection the controller wants to configure.

Returns:

- (Object) peerPickerControllerDidCancel(picker)

Tells the delegate that the user canceled the connection attempt. After this method returns, the controller dismisses the picker interface.Important: Although optional in the protocol, Game Kit expects your application to implement this method.

Parameters:

Returns: