Search code examples
iphonefacebookfacebook-graph-apifacebook-likefbconnect

How do I like a Facebook AppID through IPhone Application?


I am developing a iPhone application in which I want to simply 'Like' my own Facebook AppID.

For Facebook integration I am using FBConnect and Graph API (https://github.com/facebook/facebook-ios-sdk/blob/master/README.mdown).

After researching, I found that I was supposed to use the following method, which I attempted to implement in the "DemoAppViewController.m" of the sample code when the 'publishStream' button was selected:

NSMutableDictionary *params = [NSMutableDictionary dictionary];  //Use an empty dictionary

[_facebook requestWithGraphPath:@"https://graph.facebook.com/163221793740496/likes" 
andParams:(NSMutableDictionary *)params
andHttpMethod:@"POST" 
andDelegate:(id <FBRequestDelegate>)self];

However, my FBRequest.m 'responseString' indicates: {"error":{"type":"GraphMethodException","message":"Unsupported post request."}}

What am I doing wrong and how can I make this work?

From what I understand, all I need to do is attach my accessToken to https://graph.facebook.com/163221793740496/likes. What exactly does that mean, and how is it accomplished?

Thanks in advance!

P.S. - In case there was any confusion, my post was in reference to having a user sign into Facebook with their account login via a fb like button in the application. After the user allowed the appropriate permissions, my app would 'like' the AppID with the user's account.


Solution

  • You can't programmatically like a page on Facebook. It would be enthusiastically abused.