Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Like" a Page using the Facebook Graph API, Objective C

I'm trying to allow the user of my iOS app to "Like" a page using the following code:

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

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

I get the error message:

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."}
        }
        }

This should be part of the Graph API because it says you can use that to "Like" any object with a /Likes connections. Any help?

like image 992
quantum Avatar asked Oct 12 '22 01:10

quantum


1 Answers

Sorry to be the bearer of bad news, but apparently You can't like a Page on behalf of a user. You can, however, like posts, comments, and photos on behalf of a user.

Hope this makes sense, I've spent the last few hours trying to do simular.

Rich

like image 122
Rich Searle Avatar answered Oct 18 '22 11:10

Rich Searle