简体   繁体   English

iOS 6 - Facebook'喜欢'按钮

[英]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. 我刚刚在我的应用程序中实现了Facebook SDK 3.1.1,目的是能够在应用程序内共享图片以及“赞”我们的产品页面。 I can't seem to find a simple explanation or tutorial on how to code a button to automatically 'Like' a particular Facebook page. 我似乎无法找到关于如何编码按钮以自动“喜欢”特定Facebook页面的简单解释或教程。 Can this only be done within a UIWebView? 这只能在UIWebView中完成吗? Can anyone point me in the right direction? 谁能指出我正确的方向? Thanks. 谢谢。

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. 在iOS应用程序中喜欢Facebook页面的唯一方法是加载导航到页面的UIWebView ,然后用户可以喜欢它。

Through Vishal's answer, I came to this link which can construct an iFrame 'Like' button which can be added in a UIWebView. 通过Vishal的回答,我来到了这个链接,它可以构建一个iFrame“Like”按钮,可以在UIWebView中添加。

Construct Like Box 构造像盒子

Now you can use the FBlike button using the following code but it need to download latest sdk and it is the beta version :( 现在你可以使用下面的代码使用FBlike按钮,但它需要下载最新的sdk,它是测试版:(

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];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM