iOS: Post on wall of Selected FB Friends

血红的双手。 提交于 2019-12-04 12:55:41

You must do something like:

FBShareDialogParams *p = [[FBShareDialogParams alloc] init];
p.friends = friendIdsArray;`
p.link = url;

//check if the FB app is installed and can use this method
if ([FBDialogs canPresentShareDialogWithParams:p]) {
    [FBDialogs presentShareDialogWithParams:p 
                                clientState:nil 
                                    handler:^(FBAppCall *call,
                                        NSDictionary *results,
                                               NSError *error) {
            //do some error checking
}
// fallback to what is essentially a webview
else {
    // string of comma separated Facebook Ids
    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:@"1234,5678", @"to", nil];
    NSString *message = @"I love Objective-C";
    [FBWebDialogs presentRequestsDialogModallyWithSession:[FBSession activeSession]
                                                  message:message 
                                                    title:nil 
                                               parameters:params
                                                  handler:^(FBWebDialogResult result,
                                                                    NSURL *resultURL, NSError *error) {
              // do some error checking 
    } 

This is what I use, the only problem I'm finding is that there appears to be some unknown limit to the number of Facebook Ids you can include when sending out a request. It varies and depends on factors I can't find documented. I think FB is trying to keep people from abusing/spamming people, for good reason....

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!