在android和iphone中整合facebook与like按钮

gir*_*ish 8 iphone android facebook

我想在Android和iPhone中集成facebook和like按钮.我在facebook和iphone中集成了facebook,但我没有像按钮那样集成.所以请告诉我如何在android和iphone中集成facebook like按钮.

为了整合我在android下面使用的facebook链接示例

https://github.com/facebook/facebook-android-sdk

现在我必须整合像facebook一样的按钮.

最好的祝福.

提前致谢.

Ben*_*oot 5

看看这个很好的代码:http://angelolloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html

将FBLikeButton类添加到视图中:

FBLikeButton *likeButton = [[FBLikeButton alloc] initWithFrame:CGRectMake(0, 372, 320, 44)  
andUrl:@"http://www.facebook.com/pages/De-Zilk/108209735867960"];
Run Code Online (Sandbox Code Playgroud)

非常感谢AngelGarcíaOlloqui


Yek*_*sek 4

Facebook 图形 API 中没有“赞”按钮。您可以选择一些替代方案。首先,您可以使用网络视图并在网络视图中显示“喜欢”按钮。

https://developers.facebook.com/docs/reference/plugins/like/

另一种选择是使用 facebook-android-sdk 中的 facebook 共享功能。

最后也是更通用的替代方案是使用意图并让用户选择如何共享它。(可以是任何应用程序,包括Facebook)

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "YOUR SUBJECT HERE!");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "YOUR TEXT HERE");
startActivity(Intent.createChooser(shareIntent, "YOUR TITLE HERE"));
Run Code Online (Sandbox Code Playgroud)

  • 使用意图不起作用,因为 Android 应用程序的 Facebook 已损坏并且无法以正确的方式处理意图(消息未填充)。 (5认同)