<!--
{
  "availability" : [
    "iOS: 10.0.0 - 12.0.0",
    "iPadOS: 10.0.0 - 12.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.12.0 - 10.14.0",
    "tvOS: 10.0.0 - 12.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKGameSession/loadSessions(inContainer:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKGameSession(cm)loadSessionsInContainer:completionHandler:"
  },
  "title" : "loadSessions(inContainer:completionHandler:)"
}
-->

# loadSessions(inContainer:completionHandler:)

Retrieves all of the game sessions associated with a container.

```
class func loadSessions(inContainer containerName: String?, completionHandler: @escaping @Sendable ([GKGameSession]?, (any Error)?) -> Void)
```

## Parameters

`containerName`

A unique string that identifies the container to be accessed.

`completionHandler`

A block that is called after all the game sessions have been loaded.

- sessions: An array of `GKGameSession` objects that contains all of the game sessions associated with the specified container.
- error: If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is nil. See `GameKit Constants` for a list of error codes specific to GameKit.

## Discussion

---

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)