Question

With the new release of facebook ios sdk, the documentation is talking about the facebook like control, that allows to like a page. https://developers.facebook.com/docs/ios/like-button/

the documentation of the control is here https://developers.facebook.com/docs/reference/ios/current/class/FBLikeControl

Yet i tried it and it's not appearing, though i can detect a clear color rectangle only, i change the background color, the color appears on that rectangle, but not the facebook style as mentioned in the documentation. Additionally it doesn't work, it should take me to the fb app to show the object linked to it.

I tried through an app, while configuring the project as mentioned, AppID ... and everything. I tried also from a sample project "SessionLoginSample" that comes with facebook SDK, to no avail.

The button being clear color, seems like intentional, or something broken. It's new so I thought that there might be problems, or, i'm doing something wrong :)

Anybody?

Was it helpful?

Solution

You can use FBlikeControl button by enabling below feature in viewdidload or where you create FBlikeControl button:

[FBSettings enableBetaFeature:FBBetaFeaturesLikeButton];
[FBSettings enablePlatformCompatibility:NO];

OTHER TIPS

You can not change the size of button because its standard button provided by fb but you can use button style using below code:

Here is the complete 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];

Mawoon answered worked for me. Thank you sir.

Usage example:

[FBSettings enableBetaFeature:FBBetaFeaturesLikeButton];
[FBSettings enablePlatformCompatibility:NO];

FBLikeControl *like = [[FBLikeControl alloc] init];
like.frame = CGRectMake(itemX, itemY, 60, 20);
like.likeControlStyle = FBLikeControlStyleButton;
like.objectID = @"http://shareitexampleapp.parseapp.com/photo1/";

For some reason I'm not being able to set the 'size' of the like button, also changing the value of the likeControlStyle is not yielding any results, could be because its still a preview feature.

As mentioned here its currently only preview feature, please check screenshot. My best guess is you may not have enabled developers in Facebook applications you created through app page.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top