OGeek|极客世界-中国程序员成长平台

标题: ios - 我可以在新的 FBDialogs 中预选 friend 吗? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 22:16
标题: ios - 我可以在新的 FBDialogs 中预选 friend 吗?

我正在使用 FBDialogs 打开 Facebook Messenger(如果用户在设备上安装了它)发送个人消息。但是我不能在我的应用程序中预先选择 friend (信使总是给我一个列表并提示我在那里选择)。

FB Messenger

我正在使用 presentMessageDialogWithParams:clientState:handler: 接收 FBLinkShareParams object .

FBLinkShareParams friends array

An array of NSStrings or FBGraphUsers to tag in the post. If using NSStrings, the values must represent the IDs of the users to tag.

但是当我发送 FBGraphUsers 时,他们没有在 Messenger 应用程序中预先选择。他们应该吗?或者这只是一个“标记 friend ”功能?

我的代码:

NSMutableArray *inviteFriends = [[NSMutableArray alloc] init];

FBRequest* friendsRequest = [FBRequest requestForMyFriends];
[friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                              NSDictionary* result,
                                              NSError *error) {
    NSArray* friends = [result objectForKey"data"];
    NSLog(@"Found: %i friends", friends.count);
    for (NSDictionary<FBGraphUser>* friend in friends) {
        if ([friend.name isEqualToString"XXX"]) {
            NSLog(@"I have a friend named %@ with id %@", friend.name, friend.id);
            [inviteFriends addObject:friend];
        }
    }

    FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
    params.link = [NSURL URLWithString"https://developers.facebook.com/docs/ios/share/"];
    params.name = @"Message Dialog Tutorial";
    params.caption = @"Build great social apps that engage your friends.";
    params.picture = [NSURL URLWithString"http://i.imgur.com/g3Qc1HN.png"];
    params.description = @"Send links from your app using the iOS SDK.";
    params.friends = inviteFriends;


    // If the Facebook app is installed and we can present the share dialog
    if ([FBDialogs canPresentMessageDialogWithParams:params]) {
        [FBDialogs presentMessageDialogWithParams:params clientState:nil handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
            //
        }];
    }
}];



Best Answer-推荐答案


Messenger 会忽略“friends”和“place”参数,因为它们是专门用于标记的,而 Messenger 不支持标记。

您不能使用消息对话框指定要预选的用户。

我们将在未来更新文档以反射(reflect)这一点。

关于ios - 我可以在新的 FBDialogs 中预选 friend 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23607469/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4