[TIMOB-20484] Hyperloop: iOS: Local-embedded frameworks not working
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-08-04T09:46:22.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 5.4.0 |
| Components | Hyperloop, iOS |
| Labels | hyperloop, qe-5.4.0 |
| Reporter | Hans Knöchel |
| Assignee | Chee Kiat Ng |
| Created | 2016-02-29T13:07:35.000+0000 |
| Updated | 2016-08-04T09:46:33.000+0000 |
Description
Local-embedded frameworks in the /src/ folder are not working - like
.m and .swift files. We should find a way to recognize local-embedded frameworks correctly.
Project to reproduce: https://github.com/hansemannn/hyperloop-robot
Framework talking about: https://github.com/orbotix/Sphero-iOS-SDK/tree/master/frameworks/RobotKit.framework
The metabase seems to be generated, but the required (proof of concept) method does not work:
var RKRobotDiscoveryAgent = require("RobotKit/RKRobotDiscoveryAgent"); // works
RKRobotDiscoveryAgent.sharedAgent().isDiscovering(); // does not work - class not found
The generated metabase for the framework is attached.
*{color:red}EDIT{color}*: The problem happens with every other local-embedded framework as well. Using the attached "Serenity.framework" and the following demo code doesn't work as well. This very critical for the GA release.
var Widget = require("Serenity/Widget");
var test = new Widget();
Ti.API.warn(test.image());
Attachments
| File | Date | Size |
|---|---|---|
| robotkit.zip | 2016-05-01T09:29:22.000+0000 | 132947 |
| Serenity.zip | 2016-05-31T11:42:55.000+0000 | 93918 |
The attached Serenity.framework is empty. Is it supposed to be like that? [~hansknoechel]
Updated the Serenity framework + bundle (should not be required, but would be good to see if it works).
PR here: https://github.com/appcelerator/hyperloop.next/pull/34
Steps to test
1. *appc new --classic* 2. install the packaged hyperloop module here: https://github.com/appcelerator/hyperloop.next/releases/tag/1.2.2 3. in tiapp.xml include4. create a<modules> <module platform="iphone" version="1.2.2">hyperloop</module> </modules> <plugins> <plugin>hyperloop</plugin> </plugins>srcfolder and put Serenity.framework in 5. create aappc.jsfile, and use this as content6. inmodule.exports = { type: 'app', group: 'titanium', dependencies: { }, hyperloop: { ios: { xcodebuild: { /** * any flags available to be passed into the Xcode can be * included here to further customize the xcode build */ flags: { FRAMEWORK_SEARCH_PATHS: '../../src' }, /** * this sample doesn't use StoreKit but this demonstrates * how you can bring in frameworks explicitly. Hyperloop * will automatically determine the required frameworks * but in case you want to force a specific version, you can * include it here */ frameworks: [ 'Serenity' ] }, /** * optionally, you can bring in third-party or first-party libraries, * source code, resources etc. by including them here. The 'key' is the * name of the package that will be used in the require (if code). * the values can either be an Array or String value to the directory * where the files are located */ thirdparty: { 'Serenity': { // these can be an array or string source: ['src'], header: 'src', resource: 'src' } } } } };Resources/app.js, use thisvar Widget = require("Serenity/Widget"); Ti.API.warn(Widget.image);Some more thoughts here: Why don't we just say that frameworks can be placed in
/src/frameworksand are detected automatically? So we don't need to map them manually in the appc.js and improve the workflow when trying out new frameworks. It has always been a mess when using framework in native modules, so now we have the chance to work on that process. Maybe it's another effort for 6.0.0, but we should consider it. The same with swift and obj-c files (stored in/src/swiftand/src/objc). [~cng], [~bgrantges@appcelerator.com] thoughts?PR merged. The suggestions to improve the c-spec should be in a separate ticket :)
Steps used to test
1. *appc new --classic* 2. install the packaged hyperloop module here: https://github.com/appcelerator/hyperloop.next/releases/tag/1.2.3 3. in tiapp.xml include4. create asrcfolder and put TesseractOCR.framework in 5. addLenore3.pngto Resources/iPhone 6. add tessdata folder to Resources/iPhone 7. create aappc.jsfile, and use this as content6. in/** * Hyperloop configuration */ module.exports = { type: 'app', group: 'titanium', dependencies: { }, hyperloop: { ios: { xcodebuild: { /** * any flags available to be passed into the Xcode can be * included here to further customize the xcode build */ flags: { // GCC_PREPROCESSOR_DEFINITIONS: 'foo=bar' FRAMEWORK_SEARCH_PATHS: '../../src' }, /** * this sample doesn't use StoreKit but this demonstrates * how you can bring in frameworks explicitly. Hyperloop * will automatically determine the required frameworks * but in case you want to force a specific version, you can * include it here */ frameworks: [ 'TesseractOCR' ] }, /** * optionally, you can bring in third-party or first-party libraries, * source code, resources etc. by including them here. The 'key' is the * name of the package that will be used in the require (if code). * the values can either be an Array or String value to the directory * where the files are located */ thirdparty: { 'TesseractOCR': { // these can be an array or string source: ['src'], header: 'src', resource: 'src' } } } } };Resources/app.js, use thisvar G8Tesseract = require('TesseractOCR/G8Tesseract'); var UIImage = require('UIKit/UIImage'); var win = Ti.UI.createWindow({ backgroundColor: 'white', layout: 'vertical' }); var imageView = Ti.UI.createImageView({ image: 'Lenore3.png' }); win.add(imageView); var btn = Ti.UI.createButton({ title: 'OCR THIS' }); win.add(btn); var textArea = Ti.UI.createTextArea({ borderWidth: 2, borderColor: 'blue', width: Ti.UI.FILL, height: Ti.UI.FILL }); win.add(textArea); btn.addEventListener('click', function(e) { var tess = G8Tesseract.alloc().initWithLanguage('eng+ita'); var img = UIImage.imageNamed('Lenore3.png'); tess.setImage(img); tess.recognize(); textArea.setValue(tess.recognizedText.toString()); }); win.open();