Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27484] iOS: App fails to launch with "undefined is not an object" on iOS 9

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2019-11-12T10:09:47.000+0000
Affected Version/sRelease 8.3.0
Fix Version/sRelease 8.3.0
ComponentsiOS
LabelsengSchedule
ReporterEwan Harris
AssigneeEwan Harris
Created2019-10-21T10:08:51.000+0000
Updated2019-11-12T10:09:47.000+0000

Description

Description

When building to an iOS 9 device/simulator the following error is seen, it's probable this is down to some of the recent refactorings in the build scripts relating to ti.main
[ERROR] Script Error {
[ERROR]     column = 119;
[ERROR]     line = 5633;
[ERROR]     message = "undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(TypedArrayPrototype, Symbol.toStringTag).get')";
[ERROR]     sourceURL = "file:///Users/awam/Library/Developer/CoreSimulator/Devices/D1F3D800-B22D-43F1-A517-7BF234508D73/data/Containers/Bundle/Application/4F541A06-7C24-4A32-9595-CBD8F3410E48/ticreateapp.app/ti.main.js";
[ERROR]     stack = "    at global code(/ti.main.js:5633:119)";
[ERROR] } 

Steps to reproduce

1. Build an app to iOS 9

Actual

Error above

Expected

App should launch fine

Comments

  1. nicolomonili 2019-10-21

    With SDK *8.2.0.GA* there is no problem, the problems started with *SDK8.3*
  2. Ewan Harris 2019-10-21

    Tracked this down to [these lines](https://github.com/appcelerator/titanium_mobile/blob/74d78fb89404122f278600933c3fb9e3e32cf4d8/common/Resources/ti.internal/extensions/node/internal/util/types.js#L29-L32). Looking into the app under the debugger the Object.getOwnPropertyDescriptor(TypedArrayPrototype, Symbol.toStringTag) call returns null, it looks like Symbol.toStringTag isn't implemented in JSCore in iOS 9 (confirmed by debugging a website there), but is polyfilled by core-js for us. Looking at core-js, the node team raised this issue also https://github.com/zloirock/core-js/issues/378. We might need to update to core-js 3 to fix this (or try and patch it ourselves like we did for [Error.toJSON](https://github.com/appcelerator/titanium_mobile/blob/74d78fb89404122f278600933c3fb9e3e32cf4d8/common/Resources/ti.internal/extensions/js/Error.js#L13-L21)) cc [~jvennemann] [~cwilliams]
  3. Jan Vennemann 2019-10-21

    Might be a good opportunity to replace the deprecated @babel/polyfill with core-js directly like mentioned on the [@babel/polyfill](https://babeljs.io/docs/en/babel-polyfill) website.
  4. Ewan Harris 2019-10-22

    master: https://github.com/appcelerator/titanium_mobile/pull/11289
  5. nicolomonili 2019-10-29

    I urgently need to solve this problem with devices that mount iOS 9. It's possible to put this fix in a nightly build https://builds.appcelerator.com/#master ? Thank you
  6. Jan Vennemann 2019-10-29

    [~nicolomonili], you can build your own nightly including the outstanding PR in just a few simple steps.
       git checkout -b ewanharris-TIMOB-27484 master
       git pull https://github.com/ewanharris/titanium_mobile.git TIMOB-27484
       node build/scons.js cleanbuild <platform>
       
    If you don't specify a specific platform (either android or ios), the SDK will be build for both.
  7. Ewan Harris 2019-11-11

    8_3_X: https://github.com/appcelerator/titanium_mobile/pull/11322
  8. Samir Mohammed 2019-11-11

    FR Passed on 8_3_X
  9. Samir Mohammed 2019-11-11

    FR Passed on Master, waiting on Jenkins builds for 8_3_X and Master.
  10. Christopher Williams 2019-11-11

    merged to master and 8_3_X
  11. Samir Mohammed 2019-11-12

    *Closing ticket*, Verified fix on SDK version 9.0.0.v20191111145151 and 8.3.0.v20191111195828. Test and other information can be found at: 8_3_X: https://github.com/appcelerator/titanium_mobile/pull/11322 Master: https://github.com/appcelerator/titanium_mobile/pull/11289

JSON Source