Facebook FQL multiquery in iOS SDK

I am looking for some documentation or sample code on how to send multiquery fql requests to Facebook via iOS SDK. I found some older samples but they doesnt work for me. I have populated an NSDictionary with the queries and I try to send the request via [[FBRequest requestWithDelegate:self] call:@"facebook.fql.multiquery" params:params];, as stated in the samples I have read, but I get an "unrecognized selector sent to class" error and I cant find the "requestWithDelegate" method in FBRequest.h either. Is it deprecated? Some help on this would be very appreciated!

-------------Problems Reply------------

// Construct your FQL Query
NSString* fql = [NSString stringWithFormat:@"SELECT uid, name, hometown_location from user where uid IN (SELECT uid2 FROM friend WHERE uid1=%lld) and hometown_location != '' ORDER BY rand() limit 4", facebookId];

// Create a params dictionary
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObject:fql forKey:@"query"];

// Make the request
[facebook requestWithMethodName:@"fql.query" andParams:params andHttpMethod:@"GET" andDelegate:self];

The the delegate FBRequestDelegate will be call with the response. Depending on your needs, you'll do something like:

- (void)request:(FBRequest*)request didLoad:(id)result {
NSLog(@"didLoad() received result: %@", result);

The facebook object is created like:

Facebook * facebook = [[Facebook alloc] initWithAppId:kAppID];

More info on how to set this up can be found here: https://developers.facebook.com/docs/guides/mobile/

And depending on your FQL query, you will need permissions from the user. See the list of permissions here: https://developers.facebook.com/docs/authentication/permissions/

There is also a test console for FQL queries here: https://developers.facebook.com/docs/reference/rest/fql.query/

And if you want to do an Multiquery instead of a single query, it would look like:

NSString* fql1 = [NSString stringWithFormat:
@"select uid2 from friend where uid1 == %lld order by rand() limit 10", facebookId];
NSString* fql2 = [NSString stringWithFormat:
@"select uid, name from user where uid in (select uid2 from #queryID)"];
NSString* fql3 = [NSString stringWithFormat:
@"select uid, status_id, message from status where uid in (select uid from #queryName) limit 1"];
NSString* fql = [NSString stringWithFormat:

NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"queries"];

[facebook call:@"fql.multiquery" params:params];

Category:iphone Views:1 Time:2011-05-16

Related post

  • 'Like' functionality in FQL / Graph API / iOS SDK 2011-11-10

    Does anyone know the recommended way of creating a FaceBook 'likes' button using the iOS Facebook SDK and the Graph API or FQL. It does not seem to be directly supported or at least I can't find out how to do this using the documentation. One approac

  • Posting photos to Facebook fan page with iOS SDK 2010-11-23

    I'm trying to upload a photo to a Facebook page I own using the iOS SDK and graph API. I've been able to upload photos to my own wall. I've also been able to post a message to my fan page wall as an admin and create an album on my fan page, so I thin

  • How to add a Facebook friend via FB iOS SDK 2010-12-25

    I'm trying to let a user 'add a friend' using Facebook's iOS SDK. NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"brent", @"id", nil]; [_facebook dialog:@"friends" andParams:params andDelegate:self]; The dialog open

  • How to move to the next page in Facebook JSON response using iOS SDK? 2011-01-27

    In Facebook iOS SDK, I can ask for queries like this: [_facebook requestWithGraphPath:@"me/feed" andDelegate:self]; But often Facebook will give a limited JSON response with a URL to be used to request to move to earlier dates, for example. So in the

  • display facebook page dialog with ios sdk 2012-01-08

    I'm working with ios, and I'm trying to show a facebook page to let user like it. There is a dialog method in facebook ios sdk [facebook dialog: andDelegate:] But i can't use this method, because there are "feed","oauth" methods only. Is there any fu

  • Facebook API which supports IOS SDK 5 2012-03-04

    I have an iPhone app that is sending message to Facebook it is working fine with IOS SDK 4 but when trying to run on IOS SDK 5 it is not working and showing release and retain as errors. we are also done making "Disable ARC' and FB files are compiled

  • How to use fql.multiquery with C# SDK 2011-04-27

    I am using the facebook-c#-sdk with VB. my code: dim facebook As New FacebookApp() dim queries as string=" ""2011-4-13"" : ""SELECT metric, value FROM insights WHERE object_id=173249789387842 AND metric='page_active_users' AND end_time=end_time_date(

  • How do I get the Facebook user Id from the Facebook object in the iOS SDK? 2011-09-09

    I see that the access token is available in the Facebook object, but I don't see a Facebook user Id. I could make a graph request to "me" to get the Facebook Id, but I'd prefer not to make the extra api call. --------------Solutions------------- You

  • Facebook SSO and request iOS SDK 2011-08-22

    I am trying to post a wall message to the current user. Before I am doing the request I am validating the session and authorizing if it isn't. I left out some of the declarations and the initializing of the variables since to clarify. The problem is

  • creating facebook style timeline in ios sdk 2012-11-07

    I am trying to creating something similar to facebook timeline in facebook website. I tried searching for some examples I could not find any. Can anyone give me pointers on how to get started if I want to create one or an existing example would be gr

  • In iPhone App, How to post a photo to a Facebook fan page. Before it how to like it? using facebook-ios-sdk 2011-03-16

    Using https://github.com/facebook/facebook-ios-sdk, how can I post a photo to a facebook fan page. And before it, how can let a user become a fan of the page (i.e. like)? Even though I searched many web pages including stackoverflow, I couldn't find

  • Post photo on user's wall using Facebook iOS SDK 2011-07-15

    I'm trying to upload a photo from the camera to a user's Facebook wall. I'm not entirely sure what the correct strategy is, but from reading around it seems the thing to do is upload the photo to an album, and then someone post on the wall a link to

  • Can't connect to Facebook via Facebook iOS SDK 2011-09-08

    I'm trying to connect to facebook from my iOS application, so I can make a wall-post. I've tried using Sharekit, and also the Facebook mobile API. Using the 'stable' Sharekit, I can connect, but I'm lacking features I need with that version. So I've

  • facebook ios sdk - upload photo to fan page 2011-11-25

    Is it possible to upload/post a image to a facebook fan page, which isn't owned by me --------------Solutions------------- Yes it is. You should see this post in the link down there: Posting photos to Facebook fan page with iOS SDK

  • how to do fql.multiquery using facebook php sdk 3.0 2011-10-19

    I'm in the process of migrating from the 2.x PHP SDK to 3.x. All of the multiquery calls are broken and I haven't been able to figure out how to resolve. The facebook connect login using oauth javascript works and allows data for the current user to

  • How to get the birth day of the friends in facebook using fql in ios sdk 2011-09-06

    i am new to ios sdk, recently i'm on project in which i get all the birth day of all friends in face book ,i did this using fql,i am able to get all other details except birthday,i get only null values for birthday,birthday_date column name.. i just

  • fql.multiquery new sdk 2010-06-17

    I cannot figure out what is wrong with this fql.multiquery and cannot seem to find any examples of the new sdk with fql.multiquery. Ultimately I want to get the page name and page id(s) of the visiting user pages which they both administrator and are

  • Facebook iOS SDK - get friends list 2011-07-10

    Using the Facebook iOS SDK, how can I get an NSArray of all my friends and send them an invitation to my app? I am specifically looking for the graph path to get all of the friends. --------------Solutions------------- With Facebook SDK 3.0 you can d

  • Facebook iOS SDK too slow 2010-08-23

    I have recently wired up my application to use the Facebook iOS SDK (http://github.com/facebook/facebook-ios-sdk). The integration works fine, but the pages loads really slow. It takes really a long time to load the login screen. Login action takes m

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.104 (s). 11 q(s)