在appcelerator

时间:2016-02-08 11:05:32

标签: appcelerator appcelerator-titanium

我正在编写一个游戏,我正在使用国际化。我想与Facebook模块分享分数。我的代码:

if(fb.getCanPresentShareDialog()) {
    fb.presentShareDialog({
        link: 'https://www.facebook.com/profile.php?id=100010324151821',
        name: 'Memory Speed',
        description:String.format(L('share'), Ti.App.score),
        caption:L('caption_partage_score_facebook'),
   });
} else {
    fb.presentWebShareDialog({
        link: 'https://www.facebook.com/profile.php?id=100010324151821',
        name: 'Memory Speed',
        description:String.format(L('share'), Ti.App.score),
        caption:L('caption_partage_score_facebook'),
    });
}.

'share':链接到我的strings.xml文件

Ti.App.score:var得分

当我点击分享按钮时,应用会自行关闭。

我尝试用Ti.App.score之类的字符串替换'hello',但应用不会崩溃。

有谁知道这种行为的原因?

1 个答案:

答案 0 :(得分:1)

商店"得分"要么在全球范围内使用

 "Alloy.Globals.score" 

或将其存储在属性中,例如

  Ti.App.Properties.setString('score', '20');

并使用其中任何一个......

相关问题