Search code examples
iphoneobjective-cfacebook-ios-sdk

Post on multiple friend Facebook wall in iPhone


I am trying to post a message on all of my friends wall

Following is the code that ih ave found

 [_facebook requestWithGraphPath:@"friend_ID/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

The big problem is how can i get friend_id? is it their emails? Or how to get all lists of my friends ids


Solution

  • [_facebook requestWithGraphPath:@"me/friends" andDelegate:self];
    

    will request the list of your friends, provided that you are correctly authenticated.

    Then implement your delegate method in order to extract the id you need.

    - (void)request:(FBRequest *)request didLoad:(id)result {
        items = result[@"data"];
        for (NSDictionary * friend in items) {
            long long friendId = [friend[@"id"] longLongValue];
            // Do something with the Id
        }
    }