使用FBSDKMessenger打开特定用户的facebook Messenger

时间:2015-12-01 07:10:23

标签: ios objective-c facebook facebook-graph-api fbsdkmessengersharekit

我想通过FBSDKMessenger与特定用户分享链接和文字。我已经为此完成了所有代码,一切正常,但只有一个问题出现在用户打开信使时,用户必须手动选择朋友。

有没有办法通过 FBID 预先选择该朋友?

这是我的代码

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
    content.contentURL = [NSURL URLWithString:[dicShare valueForKey:keyContentURL]];
    content.contentTitle = [dicShare valueForKey:keyContentTitle];
    content.contentDescription = [dicShare valueForKey:keyContentDescription];

    FBSDKMessageDialog *messageDialog = [[FBSDKMessageDialog alloc] init];
    messageDialog.delegate = delegate;
    if ([messageDialog canShow])
    {
        [FBSDKMessageDialog showWithContent:content delegate:delegate];
    }
    else
    {
        UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:localize(@"title_Flare") message:[dicShare valueForKey:keyShareAlertMessage] delegate:nil cancelButtonTitle:localize(@"Ok") otherButtonTitles:nil];
        [warningAlert show];
    }

2 个答案:

答案 0 :(得分:2)

如果您想与自己的iOS应用中的合适人员打开Facebook Messenger聊天,您可以使用此类方法。 UID是facebook id,将与之打开聊天。

写于SWIFT

let messengerUrl: String = "fb-messenger://user-thread/" + String(uid)
UIApplication.sharedApplication().openURL(NSURL(string: messengerUrl)!)

答案 1 :(得分:1)

不,这不受支持。您可以准备内容(就像您一样),然后使用Failed to load resource: the server responded with a status of 404 (Not Found) http://qubedns.co.in/codes/design/hotelsr/font/fontawesome-webfont.woff@v=3.2.1 Failed to load resource: the server responded with a status of 404 (Not Found) http://qubedns.co.in/codes/design/hotelsr/font/fontawesome-webfont.ttf@v=3.2.1 Failed to load resource: the server responded with a status of 404 (Not Found) 将用户链接到Messenger,在那里他们选择要发送消息的朋友。