2012-09-01 70 views
3

我張貼上用下面的代碼當前用戶飼料後的「名字」:Facebook發佈的新聞源和鏈接背後的後

NSMutableDictionary *postParams = [[NSMutableDictionary alloc] initWithObjectsAndKeys: 
            @"http://url.com/image.jpg", @"picture", 
            @"The title of the post on the feed", @"name", 
            @"Caption text", @"caption", 
            @"Description text", @"description", nil]; 

    [self.facebook requestWithGraphPath:@"me/feed" andParams:postParams andHttpMethod:@"POST" andDelegate:nil]; 

它的偉大工程,但我想不出如何設置帖子名稱後面的鏈接(「Feed上帖子的標題」)。現在鏈接如下所示:

https://www.facebook.com/connect/uiserver.php?app_id=[MY_APP_ID]&method=permissions.request&redirect_uri=[THE_URL_OF_THE_PICTURE]&response_type=code&display=page&auth_referral=1 

有沒有辦法輕鬆控制此網址?謝謝!

- 編輯 -

這是一種後的截圖,我想創建: enter image description here

http://cl.ly/image/020D1z3S2L16。 藍色標題「Je t'aienvoyéundéfidansAnnées80」背後的鏈接非常乾淨(就像http://itunes.apple.com/app/[APP_NAME]),我也想這樣做。

我相信這不是一個開放圖形動作,只是一個基本的帖子。謝謝

+1

添加一個名爲'參數@「鏈接」'你的NSMutableDictionary ... – 2012-09-01 15:18:34

+0

已經嘗試過,但後正在轉向自己入一個「馬丁分享了一個鏈接」。我不想這樣。我已經看到人們這樣做,所以我也試圖:) – MartinMoizard

+0

你能指定它是什麼實際上是你試圖實現更多,截圖也許?我想你可能會在這裏討論一些Open Graph動作,而不僅僅是一個張貼的鏈接。 – CBroe

回答

1

「xx共享鏈接」無法通過帖子進行控制。 Facebook正在進行大量的A/B測試,以決定要顯示哪些內容...

2

Facebook提要的所有參數在Graph API參考文件https://developers.facebook.com/docs/reference/api/post/中概述。

相關的是「名稱」,「標題」,「描述」或「消息」。因此,如果您所指的元素不受影響,您無法控制它。

+0

謝謝,我知道這個網頁,但我問這個問題,因爲我看到在Facebook的帖子後面有一個乾淨的網址後面的帖子名稱,所以我正試圖做同樣的事情,但無法找到。 – MartinMoizard

1

對於現在的鏈接如下所示:

https://www.facebook.com/connect/uiserver.php?app_id=…&method=permissions.request&…

這聽起來像是你有認證轉介在您的應用程序設置中啓用了...?

這就可以解釋爲什麼鏈接指向嵌入的參數method=permissions.request的Facebook網址。

如果是這樣,那不是你想要的 - 然後轉向Authenticated Referrals。

+0

謝謝,我要試試這個 – MartinMoizard

+0

當我嘗試關閉Authenticated Referrals時,鏈接等於http://url.com/image.jpg :( – MartinMoizard

+1

那麼,這是您發佈的唯一URL值,那麼你期望什麼樣的不同行爲?如果你想發佈一個鏈接到一個實際的網站,而不是一個圖像) - 然後張貼網站的URL作爲一個「鏈接」參數;並設置此頁面以獲得適當的Open Graph元標記,如果您希望Facebook自動從中抓取信息。 – CBroe

2

嘿它很容易就試試這個代碼。

NSMutableDictionary *params = [NSMutableDictionary dictionary] ; 
    [params setObject:@"Test post" forKey:@"message"]; 
    [params setObject:@"link" forKey:@"type"]; 
    [params setObject:@"http://yoursite.com" forKey:@"link"]; 
    [params setObject:@"Link description" forKey:@"description"]; 


    // Make the request 
    [FBRequestConnection startWithGraphPath:@"/me/feed" 
           parameters:params 
           HTTPMethod:@"POST" 
          completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 
           if (!error) { 

            if(appDelegate.isLoggedInWithTwitter) 
            { 
             [self postMessage:_lblTitle.text]; 
            } 
            else 
            { 
             [self toggleProgressHud:NO title:@"" message:@""]; 
             NSLog(@"%@",[NSString stringWithFormat:@"result: %@", result]); 
             UIAlertView *alertMsg=[[UIAlertView alloc]initWithTitle:nil message:@"Shared Successfully" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil]; 
             alertMsg.tag=11; 
             alertMsg.delegate=self; 
             [alertMsg show]; 
            } 
            // Link posted successfully to Facebook 
           } else { 
            // An error occurred, we need to handle the error 
            // See: https://developers.facebook.com/docs/ios/errors 
            NSLog(@"%@",[NSString stringWithFormat:@"%@", error.description]); 
            [self toggleProgressHud:NO title:@"" message:@""]; 
            [self handleAPICallError:error]; 
           } 
          }]; 

這裏是結果要

enter image description here

相關問題