Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26857] iOS: Crash when parsing JSON from Ti.Filesystem.File.getFile()

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 8.0.0, Release 8.1.0
Fix Version/sn/a
ComponentsiOS
LabelsengSchedule
ReporterHans Knöchel
AssigneeAbir Mukherjee
Created2019-02-25T08:38:07.000+0000
Updated2020-12-04T19:50:15.000+0000

Description

We had one (always reproducible) crash that occurs everything we open a certain window. Recently we integrated Crashlytics into our Titanium app and now are finally able to catch that exception (attached). It seems like the core has an issue converting some numbers correctly:
0 JavaScriptCore
WTFCrashWithInfo(int, char const*, char const*, int, unsigned long long, unsigned long long, unsigned long long) + 12
1 JavaScriptCore
JSC::JSObject::toPrimitive(JSC::ExecState*, JSC::PreferredPrimitiveType) const + 4016
This can be reproduced using our app (steps as discussed). Note: This is *no* duplicate of TIMOB-26852.

Attachments

FileDateSize
crash.rtf2019-02-25T09:47:03.000+00004034
currencies.json2019-02-25T16:17:34.000+000027017

Comments

  1. Jan Vennemann 2019-02-25

    Apparently the crash was caused by JSON parsing when repeatedly calling the following code:
       JSON.parse(Ti.Filesystem.getFile('/currencies.json').read());
       
    Can be easily avoided by switching to require('/currencies.json');. However we should still check why the first version crashes after repeated calls.
  2. Luke Lu 2019-05-03

    @Hans Knöchel How were you able to integrate crashlytics in titanium? I tried https://github.com/hansemannn/titanium-crashlytics and few other resources but didnt get any luck
  3. dkjeune 2019-10-12

    You can add '.text' to solve your problem JSON.parse(Ti.Filesystem.getFile('/currencies.json').read().text);

JSON Source