I just implemented Facebook SDK 3.1.1 in my application in order to be able to share the photo, as well as the "How" to our product page from the application. I can’t find a simple explanation or tutorial on how to encode a button to automatically “like” a particular Facebook page. Can this be done only in UIWebView? Can someone point me in the right direction? Thanks.
See the link below that may help you in your work:
RayWenderlich: how to post to users’s wall, upload photos and add a button from your iPhone application
Unfortunately not. The only way to like a Facebook page from an iOS application is to download a UIWebView that moves to the page, and then the user may like it.
UIWebView
Through Vishal's answer, I came to this link, which can create an iFrame Like button that can be added to the UIWebView.
Build like a crate
Now you can use the FB button using the following code, but it needs to download the latest sdk, and this is a beta version :(
Here is the code:
[FBSettings enableBetaFeature:FBBetaFeaturesLikeButton]; [FBSettings enablePlatformCompatibility:NO]; FBLikeControl *like = [[FBLikeControl alloc] init]; like.objectID = @"http://shareitexampleapp.parseapp.com/photo1/"; like.likeControlHorizontalAlignment=FBLikeControlHorizontalAlignmentRight; like.likeControlStyle=FBLikeControlStyleBoxCount; [self.view addSubview like];