<!--
{
  "availability" : [
    "iOS: 4.1.0 - 8.0.0",
    "iPadOS: 4.1.0 - 8.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.8.0 - 10.10.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKMatchDelegate/match(_:didReceive:fromPlayer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(pl)GKMatchDelegate(im)match:didReceiveData:fromPlayer:"
  },
  "title" : "match(_:didReceive:fromPlayer:)"
}
-->

# match(_:didReceive:fromPlayer:)

Handles when a player receives data in a match.

```
optional func match(_ match: GKMatch, didReceive data: Data, fromPlayer playerID: String)
```

## Parameters

`match`

The match that received the data.

`data`

The bytes sent by the player.

`playerID`

The string identifier for the player that sent the data.

## Discussion

You define your own format for data packets that you transmit and receive over the network.

> Important:
> You need to treat data you receive from other players as *untrusted* data. Be sure to validate the data you receive from the match and write your code carefully to avoid security vulnerabilities.

---

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)