views:

206

answers:

2

Hi there,

How do I "like" a page using the new Facebook iOS SDK? (http://github.com/facebook/facebook-ios-sdk)

I'm currently attempting to do it with:

NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:[_facebook accessToken],@"access_token",nil];
[_facebook requestWithGraphPath:@"cocacola/likes" andParams:dict andHttpMethod:@"POST" andDelegate:self];

This doesn't work. When I NSLog([error description]); I get:

Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x6a50160 {error=<CFBasicHash 0x6a4fd40 [0x250b380]>{type = mutable dict, count = 2,
entries =>
    2 : <CFString 0x6a4fc80 [0x250b380]>{contents = "type"} = <CFString 0x6a50000 [0x250b380]>{contents = "OAuthException"}
    3 : <CFString 0x6a500e0 [0x250b380]>{contents = "message"} = <CFString 0x6a50080 [0x250b380]>{contents = "(#3) Application must be on whitelist"}
}
}

I have added my IP (the IP address my computer, as I'm running from the simulator, gets when visiting www.whatismyip.com ) to the whitelist in my Facebook application's white list under advanced settings.

Thanks!
Tristan

+2  A: 

It looks like it's a well known, but unconfirmed, bug: http://bugs.developers.facebook.net/show_bug.cgi?id=10714.

It may help if you voted for the bug in Facebook's bug tracker.

Robot K
A: 

This is not a bug, it's broken by design. Using Facebook API you are only allowed to liking posts (by sending post request to https://graph.facebook.com/POST_ID/likes&amp;auth_token=...), nothing else. Right now there is only one application which is allowed to liking pages using facebook api, it's "causes".

K. Kiełkowicz