Marius Mazeillé February 2016

facebook module crash when using internationalisation on appcelerator

I'm coding a game and I'm using internationalisation. I want to share the score with the Facebook module. My code:

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': link to my strings.xml file

Ti.App.score: var with the score

When I click on the share button, the app closes itself.

I tried to replace Ti.App.score with a string like 'hello' and the app doesn't crash.

Does anyone know the reason for this behavior?

Answers


Nilesh Patel February 2016

Store "score" either at Globally using

 "Alloy.Globals.score" 

or store it in property e.g

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

And use either of it...

Post Status

Asked in February 2016
Viewed 3,824 times
Voted 12
Answered 1 times

Search




Leave an answer