Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24284] Hyperloop: iOS - Hyperloop.defineClass fails when subclassing NSObject

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2017-04-07T19:15:37.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsHyperloop, iOS
Labelsn/a
ReporterKevin Southworth
AssigneeJan Vennemann
Created2017-01-06T20:01:38.000+0000
Updated2017-05-31T23:19:01.000+0000

Description

Hyperloop.defineClass() method is preventing my app from building with an uncaught exception during build/deploy to device or simulator. In the log output I get:
[INFO]  Processing JavaScript files
An uncaught exception was thrown!
Hyperloop.defineClass must return a class definition into a variable
I just did a File -> New Mobile App in Appcelerator Studio and added 1 line to "index.js"
var myFoo = Hyperloop.defineClass('MyFoo', 'NSObject');

function doClick(e) {
    alert($.label.text);
}

$.index.open();
I also have
<use-jscore-framework>true</use-jscore-framework>
added in my tiapp.xml no other changes from the default "new project" template in Appc Studio.

Comments

  1. Sharif AbuDarda 2017-01-07

    Hello, In what platform are you running? I tested in Android. I was not able to reproduce the issue following your guide. Am I missing something?
  2. Kevin Southworth 2017-01-07

    iOS SDK 10.2 Xcode 8.2.1 It's failing for me building for the iPad Air 2 simulator, and also failing for an actual iPad Air 2 device connected via USB.
  3. Hans Knöchel 2017-01-08

    [~ksouthworth] Does this only happen when you subclass NSObject or also other classes like UIView? And does it help to require NSObject before, as a workaround (e.g. var NSObject = require('Foundation/NSObject');)?
  4. Kevin Southworth 2017-01-09

    @Hans Knoechel I tried requiring NSObject first as you suggested, still get the same error. Tried subclassing from UIView as well, but also still get the same error.
  5. Kevin Southworth 2017-01-10

  6. Kevin Southworth 2017-01-10

    In Appcelerator Studio, with an actual iOS device selected in the run/build menu: Choosing "Run" and clicking the green play button: custom hyperloop class implementation is EMPTY Choosing "Debug" and clicking the green play button: custom hyperloop class implementation is FILLED-IN and works correctly! (I was opening the generated .xcodeproject file and looking under Hyperloop / Custom / custom.m) So seems to be something going on depending on the --deploy-type flag during compilation for actual iOS devices?? It also *fails* when I use the CLI and try to package up for iOS adhoc distribution using: ti build --platform ios --target dist-adhoc
  7. Jan Vennemann 2017-02-21

    [~ksouthworth], please see my comment in TIMOB-23679 for an explanation for the error you are seeing. The only way to workaround this currently is to use the --skip-js-minify flag for device builds.
  8. Hans Knöchel 2017-04-07

    Duplicate of TIMOB-23679.
  9. Lee Morris 2017-05-31

    Closing ticket as duplicate.

JSON Source