FacebookGamingServices module extends the Facebook SDK for iOS with features designed for Instant Games and Facebook Gaming integrations. It gives your game the ability to manage gaming contexts, send requests to friends, participate in tournaments, and upload media to a user’s Gaming Media Library.
Prerequisites
All APIs in this section require theFacebookGamingServices module. Add it to your target in addition to FacebookCore:
AccessToken.current. Make sure the user is authenticated before calling any Gaming Services APIs.
Features
Context dialogs
Create, switch, and choose Instant Games contexts to play with friends.
Game requests
Send in-game notifications and invitations to friends.
Tournaments
Fetch, update, share, and join tournaments.
Media upload
Upload images and videos to a user’s Gaming Media Library.
Current gaming context
GamingContext.current is a shared object that reflects the user’s active game instance. It is set automatically when a context dialog completes or when the app is launched via a gaming deep link.
| Property | Type | Description |
|---|---|---|
identifier | String | Unique ID for the current game instance. |
size | Int | Number of players in the current game instance. |
Gaming payload and deep link handling
When a user opens your app from a Facebook gaming deep link (for example, via a game request or tournament invite), the URL may carry a payload.GamingPayloadObserver listens for these URLs and forwards them to your delegate.
GamingPayload exposes the raw payload string carried in the deep link URL. The observer routes each URL type to the appropriate optional delegate method:
parsedGameRequestURLContaining(_:gameRequestID:)— a game request deep linkparsedGamingContextURLContaining(_:)— a gaming context deep link (also updatesGamingContext.current)parsedTournamentURLContaining(_:tournamentID:)— a tournament deep link