Search code examples
iosfacebook-graph-apifacebook-likefacebook-ios-sdk

Like a facebook page using FBLikeControl


I am trying to like a facebook page using FBLikeControl. Well I am not so sure what is the objectID I need to pass.

I tried passing the FBAPPID(as received from developers.facebook.com) as the objectID which just ends up giving a screen with no content and noting gets reflected on the page as well.

FBLikeControl *like = [[FBLikeControl alloc] init];
like.objectType = FBLikeControlObjectTypePage;
like.objectID = @"https://graph.facebook.com/265899126804837/likes";
[self.tableView addSubview:like];

enter image description here


Solution

  • If you're using FBLikeControlObjectTypePage, then the objectID should be either a page id, or a url to a Facebook Page. For example:

    like.objectID = @"https://www.facebook.com/facebook";
    

    or

    like.objectID = @"20531316728";