Javascript 钛负载Facebook个人资料图片集成不起作用
我正在寻找一种方法,将Facebook个人资料图片集成到我的钛合金应用程序中。我在谷歌上搜索了一个,然后我尝试了这个:Javascript 钛负载Facebook个人资料图片集成不起作用,javascript,facebook,facebook-graph-api,titanium,appcelerator,Javascript,Facebook,Facebook Graph Api,Titanium,Appcelerator,我正在寻找一种方法,将Facebook个人资料图片集成到我的钛合金应用程序中。我在谷歌上搜索了一个,然后我尝试了这个: var imageAvatar = Ti.UI.createImageView({ image: "http://graph.facebook.com/"+FacebookUID+"/picture", left:10, top:5, width:50, height:50 }); 但
var imageAvatar = Ti.UI.createImageView({
image: "http://graph.facebook.com/"+FacebookUID+"/picture",
left:10, top:5,
width:50, height:50
});
但这不起作用,它不会向我显示用户的个人资料图片
有人能帮我吗?多谢各位
编辑1:我也尝试过HTML,效果很好!UID不是空的,所以这不是问题所在
再编辑2个代码:
var tableData = [];
for(var i=1; i < json.length; i++) {
alert(i+' - GAME #'+json[i].GameId);
var row = Ti.UI.createTableViewRow({
className:'forumEvent', // used to improve table performance
rowIndex:i, // custom property, useful for determining the row during events
height:110
});
var imageAvatar = Ti.UI.createImageView({
image: "http://graph.facebook.com/"+Ti.App.fb.uid+"/picture",
left:10, top:5,
width:50, height:50
});
row.add(imageAvatar);
var labelUserName = Ti.UI.createLabel({
color:'#576996',
font:{fontFamily:'Arial', fontSize:defaultFontSize+6, fontWeight:'bold'},
text:'Fred Smith ' + i,
left:70, top: 6,
width:200, height: 30
});
row.add(labelUserName);
var labelDetails = Ti.UI.createLabel({
color:'#222',
font:{fontFamily:'Impact', fontSize:defaultFontSize+2, fontWeight:'normal'},
text:'Replied to post with id 1234.',
left:70, top:44,
width:360
});
row.add(labelDetails);
tableData.push(row);
}
Ti.App.multi_tableView.data = tableData;
我想你应该参考下面的链接了解更多细节 并且根据此链接,您需要在主机api url之后添加版本号,如 {用户id}/图片
这对我有用 你能再给我看一些代码吗?如果我尝试一下你的基本示例,它是有效的。我添加了更多的code=thx,你能给imageView一个背景色,这样你就可以确保它是可见的吗?完成;我只能看到背景色。我还尝试了另一个图像url,首先是一个manuell integratet facebook uid,但不起作用,然后我尝试了一个简单的图像url,效果很好。也许你需要知道这个for action是在一个json请求中,所以你用一个像这样硬编码的已知id尝试了它:这不起作用,但是另一个托管在其他地方的图像起作用了?当您在for循环/ajax请求之外直接向应用程序添加facebook图像时,它是否有效?
Ti.App.multi_tableView = Ti.UI.createTableView({
top: 60,
bottom: 80
});