2012-04-01 53 views
1

有沒有在sdk上標記照片的錯誤?因爲我讀的東西,有些人有同樣的問題...和它的新..用C#在Facebook上標記照片?

反正..我可以在Android標記的照片和它的作品..現在我想上標記C#中的照片,但我得到了一些錯誤..現在它的 「無效的照片標記主題」

這裏是我的C#代碼

 PhotoTag tags = new PhotoTag { tag_uid = "?????", x = "10", y = "10", tag_text ="heyy.."}; 
     List<PhotoTag> tagList = new List<PhotoTag>() { tags }; 
     var tagparameters = JsonConvert.SerializeObject(tagList); 
     var photoDetails = new Dictionary<string, object>(); 

     photoDetails.Add("tags", tagparameters); 
     var fbResult = client.Post("/" + photoID+ "/tags", photoDetails); 

// ********** *****************************************

public class PhotoTag 
{ 
    public string tag_uid { get; set; } 
    public string tag_text { get; set; } 
    public string x { get; set; } 
    public string y { get; set; } 
} 

我看過這裏https://developers.facebook.com/docs/reference/api/photo/

我用「到」和「身份證」,而不是「tag_uid」,但我得到了另一個錯誤。(它就像它不是一個有效的參數)

,這裏是參數輸出

[0] = {[tags, [{"tag_uid":"641194276","tag_text":"heyy..","x":"10","y":"10"}]]} 

,這裏是我的Android代碼工程..

post a photo to friend's wall on facebook with android

好..我有兩個問題

1-我的C#代碼中的錯誤在哪裏?

2 - 我如何標記一個以上的朋友?

SDK頁面上,有PHOTO_ID /標籤標籤= [{ 「ID」: 「1234」},{ 「ID」: 「12345」}]?
但正如我所解釋的,它不工作...

謝謝

回答

1

這裏我的代碼有工作:

private const string ExtendedPermissions = "user_about_me,user_photos,publish_stream"; 

[HttpPost] 
[FacebookAuthorize(Permissions = ExtendedPermissions, LoginUrl = "/Home/LogOn?ReturnUrl=~/Home")] 
public ActionResult MensagemPost(string message) 
{ 
    var fb = new FacebookWebClient(); 
    dynamic me = fb.Get("me"); 

    string friendId_1 = // get the first one friend id 
    string friendId_2 = // get the second one friend id 

    var tags = new[] 
    { 
     new { tag_uid = friendId_1, x = 20, y = 20 }, 
     new { tag_uid = friendId_2, x = 40, y = 40 }, 
     new { tag_uid = (string)me.id, x = 60, y = 60 } 
    }; 

    dynamic parameters = new ExpandoObject(); 
    parameters.message = message; 
    parameters.tags = tags; 
    parameters.url = "http://1.bp.blogspot.com/-evheT51sfeM/TlO_wZ8YDqI/AAAAAAAAA8I/fjlg0G8AgMY/s1600/The-best-top-hd-desktop-naruto-shippuden-wallpaper-naruto-shippuden-wallpapers-hd-11.jpg"; 

    dynamic result = fb.Post("me/photos", parameters); 

    return RedirectToAction("Index", new { success = true }); 
} 
+0

哇謝謝:) – unbalanced 2012-05-17 21:24:48

+0

不客氣。 =) – 2012-05-18 12:03:17

相關問題