Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can do batch requests with the Facebook iOS SDK, but you need to prepare the JSON requests yourself. Here is an example:</p> <ul> <li>First, create a JSON array string containing 2 JSON requests (see <a href="http://developers.facebook.com/docs/api/batch">http://developers.facebook.com/docs/api/batch</a>). You can use your preferred JSON API to create these strings.</li> <li>Second, create the dictionary of parameters with the "batch" key mapped to the JSON requests string.</li> <li>Then, send the request. Note that you need to put something in requestWithGraphPath. I simply put "me" (this request is NOT considered). You also MUST send it as a POST http method.</li> <li>Finally, wait for the response array in request:didLoad.</li> </ul> <hr> <pre><code>-(void) prepareMyBatchRequest { NSString *jsonRequest1 = @"{ \"method\": \"GET\", \"relative_url\": \"me/friends\" }"; NSString *jsonRequest2 = @"{ \"method\": \"GET\", \"relative_url\": \"me/albums\" }"; NSString *jsonRequestsArray = [NSString stringWithFormat:@"[ %@, %@ ]", jsonRequest1, jsonRequest2]; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:jsonRequestsArray forKey:@"batch"]; [facebook requestWithGraphPath:@"me" andParams:params andHttpMethod:@"POST" andDelegate:self]; } - (void)request:(FBRequest *)request didLoad:(id)result { NSArray *allResponses = result; for ( int i=0; i &lt; [allResponses count]; i++ ) { NSDictionary *response = [allResponses objectAtIndex:i]; int httpCode = [[response objectForKey:@"code"] intValue]; NSString *jsonResponse = [response objectForKey:@"body"]; if ( httpCode != 200 ) { NSLog( @"Facebook request error: code: %d message: %@", httpCode, jsonResponse ); } else { NSLog( @"Facebook response: %@", jsonResponse ); } } } </code></pre> <p>Concerning your other question, I don't know (try to ask other questions in distinct posts so it's easier to follow-up).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload