views:

107

answers:

1

I got Facebook Connect working and all and it's loading up the user's friends list with perfection. So now I have the logged in user's UID and the friend's UID. How would I go about calling their users.getInfo method from the SDK? The example below is what they give me to set a status, but I don't know how I can transform it to work with what I need. Especially the NSDictionary part. Please help!

Example Code -

NSString *statusString = exampleTextField.text;
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                           statusString, @"status",
                           @"true", @"status_includes_verb",
                           nil];
[[FBRequest requestWithDelegate:self] call:@"facebook.Users.setStatus" params:params];

Thanks for any help!

+1  A: 

According to the documentation at http://github.com/facebook/facebook-iphone-sdk you have to use the old API calls and the Facebook Query Language (fql) to pull information via the SDK. So you'd have to identify what information you want (or pull in a bunch and separate).

Here's the example they give to pull a user's name.

- (void)getUserName {
    NSString* fql = @"select name from user where uid == 1234";
    NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];
    [[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];
}
- (void)request:(FBRequest*)request didLoad:(id)result {
    NSArray* users = result;
    NSDictionary* user = [users objectAtIndex:0];
    NSString* name = [user objectForKey:@"name"];
    NSLog(@"Query returned %@", name);
}

getUserName shows you the data pull which you could adapt to create new routines--but the request:didLoad: function would need some internal switching.

Ryan Garcia