The FBRequestDelegate protocol defines the methods that a delegate of a Facebook object may implement. These methods are defined in FBRequest.h.
The protocol declares methods that are implemented by your application to handle Graph API, FQL, and Legacy REST API callbacks. All the methods defined in this protocol are optional.
You should implement the protocol methods if you want to handle one or more of the following scenarios:
The API call fails. You can alert the user or take a specific action.
The API call succeeds. You can process the results returned according to the API method called.
Sent to the delegate just before the request is sent to the server.
- (void)requestLoading:(FBRequest *)request;
Parameters
request - The Facebook request object.
Notes
You may want to handle any set up before the API call in your implementation.
Sent to the delegate when the server responds and begins to send back data.
- (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response;
Parameters
request - The Facebook request object.
response - The response data
Notes
You may want to implement this to handle the start of the response return.
Sent to the delegate when an error prevents the request from completing successfully.
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error;
Parameters
request - The Facebook request object.
error - The API error.
Notes
You may want to implement this to handle the error path of the API call.
Sent to the delegate when a request returns and its response has been parsed into an object.
- (void)request:(FBRequest *)request didLoad:(id)result;
Parameters
request - The Facebook request object.
id - The result object. The result may be a dictionary, an array, a string, or a number, depending on the format of the API response
Notes
You may want to implement this to handle the processing of the data from the API call.
Sent to the delegate when a request returns a response.
- (void)request:(FBRequest *)request didLoadRawResponse:(NSData *)data;
Parameters
request - The Facebook request object.
data - The raw response from the server.
Notes
You may want to implement this to handle the processing of the server data if you need access to the raw response.