Reputation: 4675
I have just implemented Facebook SDK 3.1.1 into my app with the intention of being able to share a picture, as well as 'Like' our product page from within the app. I can't seem to find a simple explanation or tutorial on how to code a button to automatically 'Like' a particular Facebook page. Can this only be done within a UIWebView? Can anyone point me in the right direction? Thanks.
Upvotes: 4
Views: 4963
Reputation: 1045
Now you can use the FBlike button using the following code but it need to download latest sdk and it is the 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];
Upvotes: 0
Reputation: 4675
Through Vishal's answer, I came to this link which can construct an iFrame 'Like' button which can be added in a UIWebView.
Upvotes: 0
Reputation: 2113
Unfortunately, no. The only way to like a Facebook page from within the iOS app, is to load up a UIWebView
that navigates to the page, and then the user can like it.
Upvotes: 1