0

我正在制作一个应用程序,我想在页面底部有一个 facebook“Like”按钮。甚至可能吗?我玩过不同的东西,这就是我现在所拥有的。var win = Ti.UI.currentWindow;

win.showNavBar(); // Force the navbar to show

var bgImage = Ti.UI.createImageView({
height  : 'auto',
top     : -11,
image   : 'images/h-4.jpg',
zIndex  : 0
});
win.add(bgImage);

var ticksterImage = Ti.UI.createImageView({
height  : 'auto',
top     : 1,
image   : 'images/takida.png',
zIndex  : 0
});
win.add(ticksterImage);

var facelike = Ti.UI.createWebView({
html: '<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftakidamusic&send=false&layout=standard&width=320&show_faces=true&action=like&colorscheme=dark&font&height=80&appId=368268836546636" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:320px; height:80px;" allowTransparency="true"></iframe>',
height: '80dp',
bottom: 1,

});
win.add(facelike);

我要解决这个问题吗?我应该用 HTML5 或 XFBML 代替 iframe 吗?我已经尝试了所有三个但没有结果。我刚得到:加载应用程序时出错://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftakidamusic&send=false&layout=standard&width=320&show_faces=true&action=like&colorscheme=dark&font&height= 80&appId=234826439948817

这是另一种方式吗?

Thanx //R — Rickard Harrysson 6 小时前问

4

1 回答 1

0

我建议不要使用 webview - 尝试使用 Ti.Facebook 模块。这将使您在允许用户通过 Titanium 登录 Facebook 时更加灵活。有关示例,请参见 KitchenSink。

https://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/facebook.js

如果您必须使用网站,则 html 必须是完整的网页,而不仅仅是 iframe。它应该以<html><head/><body>. 我建议在 Titanium 之外创建一个可以工作的网页,然后将该页面的 html 插入到 html 属性中。

于 2012-05-27T04:07:13.947 回答