Search code examples
iosobjective-cfacebook-likefacebook-ios-sdk

FBLikeControl does not open Facebook app


I have implemented FBLikeControl on ios. Now if I login to app with Facebook login and Facebook app is installed in my device it always opens page in Safari instead of Facebook app.

I have used following code for the like

FBLikeControl *like = [[FBLikeControl alloc] init];
like.likeControlHorizontalAlignment = FBLikeControlHorizontalAlignmentCenter;
like.objectID = @"https://www.facebook.com/***my page***";
like.objectType = FBLikeControlObjectTypePage;
like.preferredMaxLayoutWidth = 400.0f;
like.likeControlStyle = FBLikeControlStyleBoxCount;
[self.view addSubview:like];

Solution

  • As commented by @MingLi, FBLikeControl will only open the Facebook app if supported version is available on device.