ios – 发送与Facebook消息对话的链接忽略所有参数

我试图通过在v2.0中实现的新Facebook消息对话框分享/发送给朋友的链接.

我一直在遵循文档的指示:https://developers.facebook.com/docs/ios/share#message-dialog-getting-started
这就是我尝试过的:

[FBDialogs presentMessageDialogWithLink:[NSURL URLWithString:@"http://XXX.net/"] name:@"NAME" caption:@"CAPTION" description:@"DESCRIPTION" picture:nil clientState:nil handler:^(FBAppCall *call,NSDictionary *results,NSError *error) {
            if(error) {
                // An error occurred,we need to handle the error
                // See: https://developers.facebook.com/docs/ios/errors
                NSLog([Nsstring stringWithFormat:@"Error messaging link: %@",error.des

cription]);
        } else {
            // Success
            NSLog(@"result %@",results);
        }
    }];

而这:(应该是同一件事)

FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
    params.link = [NSURL URLWithString:@"http://xxx.net/"];
    params.name = @"NAME";
    params.caption = @"CAPTION";
    //params.picture = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/en/c/cd/Aller_Media_logo.png"];
    params.linkDescription = @"DESCRIPTION";

    [FBDialogs presentMessageDialogWithParams:params clientState:nil
                                    handler:^(FBAppCall *call,NSError *error) {
                                        if(error) {
                                            // An error occurred,we need to handle the error
                                            // See: https://developers.facebook.com/docs/ios/errors
                                            NSLog([Nsstring stringWithFormat:@"Error messaging link: %@",error.description]);
                                        } else {
                                            // Success
                                            NSLog(@"result %@",results);
                                        }
                                    }];

这两种方法都会在我的Facebook Messenger应用程序中显示预先填充了我的参数的对话框.但是当我发送消息时,除了链接之外的所有内容都是GONE在接收方端.

根据我的理解,用户不必通过应用程序登录,以便能够从Facebook消息对话框发送消息.

有没有人知道这里发生了什么?这是一个Facebook Bug吗?

编辑:这已被确认为facebook-bug:https://developers.facebook.com/bugs/1547232035503916

解决方法

虽然这个错误已在2014年6月修复,但仍有可能与最新的Facebook示例代码有类似的问题.在最新的示例“FBShareSample”和Facebook“在iOS中共享”文档中,他们使用该方法
[FBDialogs presentShareDialogWithLink:....]

它仅使用参数中的链接而不使用其余参数(尽管后备示例Feed对话实际上使用了所有参数).要使用共享对话框中的所有参数,您需要使用

[FBDialogs presentShareDialogWithParams:...]

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...