[AC-200] iOS: Using buildin moment.js case uncaught exception
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2015-08-05T08:11:56.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Ethan Chen |
Assignee | Radamantis Torres-Lechuga |
Created | 2015-07-07T02:03:24.000+0000 |
Updated | 2015-08-19T17:49:16.000+0000 |
Description
I'm using buildin moment.js with locale
zh-Hant
,
but I got a uncaught exception and exit the app automatically.
/alloy/moment/lang/zh-Hant.js, Resource: alloy/moment/lang/zh-Hant_js
Uncaught exception: Couldn't find module: alloy/moment/lang/zh-Hant for architecture: i386
Controller:
var moment = require('alloy/moment');
console.log(moment.version)
even though I use a moment + locales.js
from [official site](http://momentjs.com/) and put the file moment.js on lib
, same problem just happened:
var moment = require('moment');
moment.locale('en-US'); // exception
moment.locale('en-us'); // exception
moment.locale('zh-TW'); // exception
moment.locale('zh-tw'); // exception
moment.locale('zh-CN'); // exception
moment.locale('zh-cn'); // exception
moment.locale('en'); // working fine
Hello, We did not reproduce this issue when we use Alloy.builtins.moment we get this following
*Output*
When we use moment + locales.js from [official site](http://momentjs.com/) and put the file on Assets folder and the result, is
*Output*
We did not get any exception. Thanks
In the [document](http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Controllers) it says: {quote} Some JavaScript code might not be suitable as controller code, since it does not have an associated view, or you want to separate it from the MVC framework for easier reusability. Create a folder called
lib
in theapp
directory of your Alloy project. Add your CommonJS modules or JavaScript code using the CommonJS format into the lib folder. These files are copied to the Resources folder, when compiling your Alloy project. {quote} so I put mymoment.js
intoapp/lib
, but still got exception bq.I try putting the
moment.js
inapp/assets
folder, same test code, same exceptions, same crushes.Hello [~ethancfchen], Please test with latest Studio 4.1.1 and SDK 4.1.0 and let us know. Thanks.
Hi. I was able to made it work as @Motiur explained with Ti 4.1.1 (getting moment-with-locales and putting it in assets), but I have one question: Is this the new way to use localized moments? In Ti3.5.0GA the translations worked alone, you only need to set the format and moment get the current device language alone. Why this changed in 4.1.1?