The Gaming Services SDK lets you upload images and videos directly to a user’s Facebook Gaming Media Library. After a successful upload you can optionally launch the native media sharing dialog so the user can share the content immediately.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/facebook-ios-sdk/llms.txt
Use this file to discover all available pages before exploring further.
A valid
AccessToken.current is required for both image and video uploads. Calls made without an access token will fail with an error.Uploading images
UseGamingImageUploader to upload a UIImage to the user’s Gaming Media Library.
Configure the upload
Create aGamingImageUploaderConfiguration with the image you want to upload.
| Parameter | Type | Description |
|---|---|---|
image | UIImage | The image to upload. The SDK converts it to PNG data before sending. |
caption | String? | Optional text that appears alongside the image on Facebook. |
shouldLaunchMediaDialog | Bool | When true, opens the Facebook media dialog after a successful upload so the user can share the image. |
Start the upload
result dictionary contains an "id" key with the uploaded photo’s ID when shouldLaunchMediaDialog is false. When shouldLaunchMediaDialog is true, the completion fires after the user returns from the media dialog.
Track upload progress
Pass an optional progress handler to monitor bytes transferred:| Parameter | Type | Description |
|---|---|---|
bytesSent | Int64 | Bytes sent since the last invocation. |
totalBytesSent | Int64 | Total bytes sent so far. |
totalBytesExpectedToSend | Int64 | Total size of the upload. |
Uploading videos
UseGamingVideoUploader to upload a video file from local disk.
Configure the upload
| Parameter | Type | Description |
|---|---|---|
videoURL | URL | A file URL pointing to the video on disk. |
caption | String? | Optional text that appears alongside the video on Facebook. |
Start the upload
result dictionary contains a "video_id" key with the uploaded video’s ID.