Inherits from NSObject
Declared in FBSDKGraphRequestConnection.h

Overview

@class FBSDKGraphRequestConnection

@abstract The FBSDKGraphRequestConnection represents a single connection to Facebook to service a request.

@discussion The request settings are encapsulated in a reusable FBSDKGraphRequest object. The FBSDKGraphRequestConnection object encapsulates the concerns of a single communication e.g. starting a connection, canceling a connection, or batching requests.

Properties

URLResponse

@abstract The raw response that was returned from the server. (readonly)

@property (nonatomic, retain, readonly) NSHTTPURLResponse *URLResponse

Discussion

@discussion This property can be used to inspect HTTP headers that were returned from the server.

The property is nil until the request completes. If there was a response then this property will be non-nil during the FBSDKGraphRequestHandler callback.

Declared In

FBSDKGraphRequestConnection.h

delegate

@abstract The delegate object that receives updates.

@property (nonatomic, weak) id<FBSDKGraphRequestConnectionDelegate> delegate

Declared In

FBSDKGraphRequestConnection.h

timeout

Gets or sets the timeout interval to wait for a response before giving up.

@property (nonatomic) NSTimeInterval timeout

Declared In

FBSDKGraphRequestConnection.h

Class Methods

setDefaultConnectionTimeout:

@method

+ (void)setDefaultConnectionTimeout:(NSTimeInterval)defaultConnectionTimeout

Parameters

defaultConnectionTimeout

The timeout interval.

Discussion

@abstract This method sets the default timeout on all FBSDKGraphRequestConnection instances. Defaults to 60 seconds.

Declared In

FBSDKGraphRequestConnection.h

Instance Methods

addRequest:completionHandler:

@method

- (void)addRequest:(FBSDKGraphRequest *)request completionHandler:(FBSDKGraphRequestHandler)handler

Parameters

request

A request to be included in the round-trip when start is called.

handler

A handler to call back when the round-trip completes or times out.

Discussion

@abstract This method adds an FBSDKGraphRequest object to this connection.

@discussion The completion handler is retained until the block is called upon the completion or cancellation of the connection.

Declared In

FBSDKGraphRequestConnection.h

addRequest:completionHandler:batchEntryName:

@method

- (void)addRequest:(FBSDKGraphRequest *)request completionHandler:(FBSDKGraphRequestHandler)handler batchEntryName:(NSString *)name

Parameters

request

A request to be included in the round-trip when start is called.

handler

A handler to call back when the round-trip completes or times out. The handler will be invoked on the main thread.

name

An optional name for this request. This can be used to feed the results of one request to the input of another FBSDKGraphRequest in the same FBSDKGraphRequestConnection as described in Graph API Batch Requests.

Discussion

@abstract This method adds an FBSDKGraphRequest object to this connection.

@discussion The completion handler is retained until the block is called upon the completion or cancellation of the connection. This request can be named to allow for using the request’s response in a subsequent request.

Declared In

FBSDKGraphRequestConnection.h

addRequest:completionHandler:batchParameters:

@method

- (void)addRequest:(FBSDKGraphRequest *)request completionHandler:(FBSDKGraphRequestHandler)handler batchParameters:(NSDictionary *)batchParameters

Parameters

request

A request to be included in the round-trip when start is called.

handler

A handler to call back when the round-trip completes or times out.

batchParameters

The optional dictionary of parameters to include for this request as described in Graph API Batch Requests. Examples include “depends_on”, “name”, or “omit_response_on_success”.

Discussion

@abstract This method adds an FBSDKGraphRequest object to this connection.

@discussion The completion handler is retained until the block is called upon the completion or cancellation of the connection. This request can be named to allow for using the request’s response in a subsequent request.

Declared In

FBSDKGraphRequestConnection.h

cancel

@method

- (void)cancel

Discussion

@abstract Signals that a connection should be logically terminated as the application is no longer interested in a response.

@discussion Synchronously calls any handlers indicating the request was cancelled. Cancel does not guarantee that the request-related processing will cease. It does promise that all handlers will complete before the cancel returns. A call to cancel prior to a start implies a cancellation of all requests associated with the connection.

Declared In

FBSDKGraphRequestConnection.h

overrideVersionPartWith:

@method

- (void)overrideVersionPartWith:(NSString *)version

Parameters

version

This is a string in the form @“v2.0” which will be used for the version part of an API path

Discussion

@abstract Overrides the default version for a batch request

@discussion The SDK automatically prepends a version part, such as “v2.0” to API paths in order to simplify API versioning for applications. If you want to override the version part while using batch requests on the connection, call this method to set the version for the batch request.

Declared In

FBSDKGraphRequestConnection.h

setDelegateQueue:

Determines the operation queue that is used to call methods on the connection’s delegate.

- (void)setDelegateQueue:(NSOperationQueue *)queue

Parameters

queue

The operation queue to use when calling delegate methods.

Discussion

By default, a connection is scheduled on the current thread in the default mode when it is created. You cannot reschedule a connection after it has started.

This is very similar to [NSURLConnection setDelegateQueue:].

Declared In

FBSDKGraphRequestConnection.h

start

@method

- (void)start

Discussion

@abstract This method starts a connection with the server and is capable of handling all of the requests that were added to the connection.

By default, a connection is scheduled on the current thread in the default mode when it is created. See setDelegateQueue: for other options.

This method cannot be called twice for an FBSDKGraphRequestConnection instance.

Declared In

FBSDKGraphRequestConnection.h