[TIMOB-24284] Hyperloop: iOS - Hyperloop.defineClass fails when subclassing NSObject
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2017-04-07T19:15:37.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Hyperloop, iOS |
Labels | n/a |
Reporter | Kevin Southworth |
Assignee | Jan Vennemann |
Created | 2017-01-06T20:01:38.000+0000 |
Updated | 2017-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.
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?
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.
[~ksouthworth] Does this only happen when you subclass
NSObject
or also other classes likeUIView
? And does it help to requireNSObject
before, as a workaround (e.g.var NSObject = require('Foundation/NSObject');
)?@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.
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
[~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.Duplicate of TIMOB-23679.
Closing ticket as duplicate.