Kevin_TA
Kevin_TA

Reputation: 4675

iOS 6 - Facebook 'Like' Button

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

Answers (4)

Mawoon
Mawoon

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

Vishal
Vishal

Reputation: 8256

See the link below which may help you in your work:

RayWenderlich: How To Post to a User’s Wall, Upload Photos, and Add a Like Button from your iPhone App

Upvotes: 3

Kevin_TA
Kevin_TA

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.

Construct Like Box

Upvotes: 0

jakenberg
jakenberg

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

Related Questions