[TIMOB-23665] [Hyperloop] iOS: custom class is not added to Xcode project and compiled if no other frameworks are being used in the project
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-07-29T22:58:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Hyperloop, iOS, Tooling |
Labels | n/a |
Reporter | Chris Bowley |
Assignee | Jan Vennemann |
Created | 2016-07-20T19:12:01.000+0000 |
Updated | 2016-08-01T20:28:54.000+0000 |
Description
Creating a new project, enabling Hyperloop and adding a custom class does not work unless a Cocoa Touch framework is also referenced.
Steps:
* Create new project
* Configure the project for Hyperloop
* Add a custom Obj-C class '
MyClass
', declare it in appc.js
and require it in index.js
controller
Result:
* MyClass metabase JS file is generated
* MyClass is not added to the Xcode project and therefore not compiled
* No build-time error, run time error Cannot find class with name: MyClass
I have tracked down the cause:
Custom classes and frameworks are added to the Xcode project in the plugin updateXcodeProject
function. This function makes this check for content in this.nativeModules
: https://github.com/appcelerator/hyperloop.next/blob/master/iphone/plugin/hyperloop.js#L672. this.nativeModules
is populated here: https://github.com/appcelerator/hyperloop.next/blob/master/iphone/plugin/hyperloop.js#L574.
I have attached an example project which demonstrates the error.
Attachments
File | Date | Size |
---|---|---|
CustomClassTest.zip | 2016-07-20T19:11:57.000+0000 | 10475506 |
PR: https://github.com/appcelerator/hyperloop.next/pull/43 Thanks [~cbowley] for the detailed description of this issue! Really helped me to jump right in^^ Thanks to your demo project i was able to address a similar issue with swift files. The PR contains fixes for both issues.
CR and FT passed.
Steps to test
1. download the sample app 2. configure it accordingly to the correct version of hyperloop 3. *appc run -p ios -l trace*Expected result
On the console, you will see[INFO] MyClass.hello(): hello
and no errors.Reopening ticket. I do not see this fix in Ti SDK 5.4.0.v20160727143921. Looks like the fix went only into master branch.
[~wluu] Just to be ensure: The fix is part of the Hyperloop module, not the core SDK. So you need to replace the Hyperloop version with the latest hyperloop.next build (not in the releases tab, yet). Can you compile the module and test it from there? Otherwise, I would compile it for you on Monday.
[~hansknoechel], My bad, misread the PR. But yes, I was able to verify the fix with the latest Hyperloop module 1.2.5. Will resolve ticket again, but won't close until Hyperloop 1.2.5 is released. Tested on: Appc CLI NPM: 4.2.7 Appc CLI Core: 5.4.0-37 Arrow: 1.8.2 SDK: 5.4.0.v20160727143921 Hyperloop: 1.2.5 Node: v4.4.7 OS: Mac OS X (10.11.6) Xcode: 7.3.1 Device: iphone 6 simulator (9.3)
Closing ticket as fixed. Verified that if I use the attached sample with Hyperloop 1.2.5, then I do not get the runtime error. Tested on: Appc CLI NPM: 4.2.7 Appc CLI Core: 5.4.0-37 Arrow: 1.8.2 SDK: 5.4.0.v20160801022303 Hyperloop: 1.2.5 Node: v4.4.7 OS: Mac OS X (10.11.6) Xcode: 7.3.1 Device: iphone 6 plus (9.1)