FBLikeControl does not load nor function

2019-02-25 02:09发布

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?

4条回答
小情绪 Triste *
2楼-- · 2019-02-25 02:47

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];
查看更多
再贱就再见
3楼-- · 2019-02-25 02:50

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

[FBSettings enableBetaFeature:FBBetaFeaturesLikeButton];
[FBSettings enablePlatformCompatibility:NO];
查看更多
小情绪 Triste *
4楼-- · 2019-02-25 03:02

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

查看更多
一夜七次
5楼-- · 2019-02-25 03:09

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.

查看更多
登录 后发表回答