2011-05-17 33 views
5

我試圖讓我的iOS應用程序的用戶「喜歡」頁面使用下面的代碼:「贊」頁面使用Facebook的圖形API,目標C

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"access_token",[[NSUserDefaults standardUserDefaults] objectForKey:@"fb_accessToken"], nil]; 

[facebook requestWithGraphPath:@"PAGE_ID/likes" andParams:params andHttpMethod:@"POST" andDelegate:self]; 

我得到的錯誤消息:

Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x624d560 {error=<CFBasicHash 0x6243fb0 [0x171e400]>{type = mutable dict, count = 2, 
     entries => 
      2 : <CFString 0x624cec0 [0x171e400]>{contents = "type"} = <CFString 0x624bc40 [0x171e400]>{contents = "OAuthException"} 
      3 : <CFString 0x624aaf0 [0x171e400]>{contents = "message"} = <CFString 0x6248b50 [0x171e400]>{contents = "(#3) Application does not have the capability to make this API call."} 
     } 
     } 

這應該是圖形API的一部分,因爲它說,你可以用它來「贊」與任何對象/喜歡連接。任何幫助?

回答

5

抱歉是壞消息的持有者,但顯然你不能代表用戶喜歡頁面。但是,您可以代表用戶發佈帖子,評論和照片。

希望這是有道理的,我花了最後幾個小時試圖做simular。

豐富

+0

好的謝謝...不幸的是,雖然。 – quantum 2011-05-18 05:11:20

+2

一般的共識似乎是,你不能代表用戶喜歡頁面,但我只是代表我的頁面有一個ios遊戲。極限之旅成功設法讓你喜歡他們自己的頁面。我希望當我現在做的時候我會更加關注...... – wallacer 2011-09-01 15:52:01

+0

hi @wallacer!我正在尋找同樣的案例喜歡從iOS應用程序的應用程序的Facebook頁面。你找到任何方式喜歡從應用程序本身的應用程序自己的頁面? 內置像Facebook一樣的行爲只允許像對象(評論,帖子,照片),但不是頁面。 任何建議plz? – 2013-02-18 07:20:53

0

https://developers.facebook.com/docs/reference/rest/stream.addLike/

又像後

NSMutableDictionary* dict = [[[NSMutableDictionary alloc]initWithObjectsAndKeys:PostId,@"post_id",nil]autorelease]; 

[AppDelegate.facebook requestWithMethodName:@"stream.addLike" andParams:dict andHttpMethod:@"POST" andDelegate:self]; 

和刪除像

NSMutableDictionary* dict = [[[NSMutableDictionary alloc]initWithObjectsAndKeys:PostId,@"post_id",nil]autorelease]; 

[AppDelegate.facebook requestWithMethodName:@"stream.removeLike" andParams:dict andHttpMethod:@"POST" andDelegate:self];` 
-1

我花了10小時該解決方案。

但是不幸的是,沒有辦法..即使他們在「喜歡」圖表api中說過「任何對象」,但它僅限於「用戶,它是帖子,評論和照片」。

0

由Eric Kassan鏈接的頁面的第二段指出:「og.likes動作可以引用任何開放圖形對象或URL,,除了Facebook頁面或照片。」

相關問題