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.
Creating a request
UseGraphRequest to build a request with a graph path and an optional parameters dictionary. The fields parameter controls which fields the API returns.
Starting with Graph API v2.4, GET requests must include an explicit
fields parameter. The SDK logs a developer warning if you omit it.Starting the request
Callstart(_:) to fire the request. The completion closure receives a connection, a result, and an error.
start(_:) returns an object conforming to GraphRequestConnecting that you can use to cancel the request before it completes.
HTTP methods
The SDK defines three HTTP methods:| Constant | Value |
|---|---|
FBSDKHTTPMethodGET | "GET" |
FBSDKHTTPMethodPOST | "POST" |
FBSDKHTTPMethodDELETE | "DELETE" |
Using a specific access token
By default,GraphRequest reads the token string from AccessToken.current. To supply a different token, use the full initialiser:
nil for tokenString causes the SDK to fall back to AccessToken.current.
Error handling
Theerror parameter in the completion handler is an NSError. Check error.userInfo for Graph API-specific details:
| Key | Description |
|---|---|
FBSDKGraphRequestErrorKey | Error category (transient, recoverable, non-recoverable) |
FBSDKGraphRequestErrorGraphErrorCodeKey | Graph API error code |
FBSDKGraphRequestErrorGraphErrorSubcodeKey | Graph API error subcode |
FBSDKGraphRequestErrorHTTPStatusCodeKey | HTTP status code |