<!--
{
  "availability" : [
    "iOS: 3.0.0 - 7.0.0",
    "iPadOS: 3.0.0 - 7.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKPeerPickerControllerDelegate/peerPickerController(_:sessionFor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(pl)GKPeerPickerControllerDelegate(im)peerPickerController:sessionForConnectionType:"
  },
  "title" : "peerPickerController(_:sessionFor:)"
}
-->

# peerPickerController(_:sessionFor:)

Asks the delegate to return a session for the specified connection type.

```
optional func peerPickerController(_ picker: GKPeerPickerController, sessionFor type: GKPeerPickerConnectionType) -> GKSession
```

## Parameters

`picker`

The controller requesting the session.

`type`

The type of connection the controller wants to configure.

## Discussion

Your delegate is responsible for providing a [`GKSession`](/documentation/GameKit/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 ([`GKSessionMode.peer`](/documentation/GameKit/GKSessionMode/peer)).

If your delegate does not implement this method and the user selected a network of type [`GKPeerPickerConnectionType.nearby`](/documentation/GameKit/GKPeerPickerConnectionType/nearby), the peer controller allocates a new session that advertises itself as a peer ([`GKSessionMode.peer`](/documentation/GameKit/GKSessionMode/peer)) with the default [`sessionID`](/documentation/GameKit/GKSession/sessionID) and [`displayName`](/documentation/GameKit/GKSession/displayName) parameters.

### Special Considerations

In iOS 3.0, your delegate receives requests only for networks of type [`GKPeerPickerConnectionType.nearby`](/documentation/GameKit/GKPeerPickerConnectionType/nearby).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)