Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20484] Hyperloop: iOS: Local-embedded frameworks not working

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-08-04T09:46:22.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsHyperloop, iOS
Labelshyperloop, qe-5.4.0
ReporterHans Knöchel
AssigneeChee Kiat Ng
Created2016-02-29T13:07:35.000+0000
Updated2016-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

FileDateSize
robotkit.zip2016-05-01T09:29:22.000+0000132947
Serenity.zip2016-05-31T11:42:55.000+000093918

Comments

  1. Chee Kiat Ng 2016-05-30

    The attached Serenity.framework is empty. Is it supposed to be like that? [~hansknoechel]
  2. Hans Knöchel 2016-05-31

    Updated the Serenity framework + bundle (should not be required, but would be good to see if it works).
  3. Chee Kiat Ng 2016-06-01

    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 include
         <modules>
           <module platform="iphone" version="1.2.2">hyperloop</module>
         </modules>
         <plugins>
           <plugin>hyperloop</plugin>
         </plugins>
       
    4. create a src folder and put Serenity.framework in 5. create a appc.js file, and use this as content
       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: {
       					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'
       				}
       			}
       		}
       	}
       };
       
    6. in Resources/app.js, use this
       var Widget = require("Serenity/Widget");
       Ti.API.warn(Widget.image);
       
  4. Hans Knöchel 2016-06-07

    Some more thoughts here: Why don't we just say that frameworks can be placed in /src/frameworks and 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/swift and /src/objc). [~cng], [~bgrantges@appcelerator.com] thoughts?
  5. Chee Kiat Ng 2016-06-09

    PR merged. The suggestions to improve the c-spec should be in a separate ticket :)
  6. Josh Longton 2016-06-30

    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 include
       <ios>
       	<use-app-thinning>false</use-app-thinning>
       	<use-jscore-framework>true</use-jscore-framework>
       </ios>
       
       <modules>
       	<module platform="iphone" version="1.2.3">hyperloop</module>
       </modules>
       
       <plugins>
       	<plugin>hyperloop</plugin>
       </plugins>
       
    4. create a src folder and put TesseractOCR.framework in 5. add Lenore3.png to Resources/iPhone 6. add tessdata folder to Resources/iPhone 7. create a appc.js file, and use this as content
       /**
        * 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'
       				}
       			}
       		}
       	}
       };
       
    6. in Resources/app.js, use this
       var 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();
       

JSON Source