2014-05-12 64 views
2

我使用FBDialogs打開Facebook Messenger(如果用戶已將其安裝在設備上)發送個人消息。不過,我不能在我的應用程序中預選好友(使者總是給我一個列表並提示我在那裏選擇)。我可以在新的FBDialogs中預選好友嗎?

FB Messenger

我使用presentMessageDialogWithParams:clientState:handler:接收FBLinkShareParams object

FBLinkShareParams朋友陣列

NSString的數組或FBGraphUsers在後標記。如果使用NSString,則這些值必須表示要標記的用戶的ID。

但是,當我發送FBGraphUsers他們不預先選擇在Messenger應用程序。他們應該嗎?或者這只是一個「標記朋友」功能?

我的代碼:

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) { 
      // 
     }]; 
    } 
}]; 

回答

1

「朋友」和「地方」參數是通過信使,因爲那些忽略特定的標記,和Messenger不支持標籤。

您不能指定用戶使用消息對話框預選。

我們將在未來更新文檔以反映此情況。

+2

從那時起有什麼變化? – squixy

相關問題