Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23729] Hyperloop: iOS: Local-embedded frameworks not working with TICORE

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-08-04T10:13:27.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsHyperloop, iOS
Labelsn/a
ReporterChee Kiat Ng
AssigneeEric Merriman
Created2016-08-04T09:41:35.000+0000
Updated2017-03-31T22:27:59.000+0000

Description

Just found out that local frameworks will get a build failure if false You are going to need this framework and this tessdata. https://github.com/gali8/Tesseract-OCR-iOS https://github.com/tesseract-ocr/tessdata or look for [~jlongton].

Steps to reproduce

1. *appc new --classic* 2. install the packaged hyperloop module here: https://github.com/appcelerator/hyperloop.next/releases/tag/1.2.5 3. in tiapp.xml include
<ios>
	<use-app-thinning>false</use-app-thinning>
	<use-jscore-framework>false</use-jscore-framework>
</ios>

<modules>
	<module platform="iphone" version="1.2.5">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();

Expected Result

app builds flawlessly

Actual Result

[TRACE] :  /Users/kiat/titaniumTestWatch/HLTesseract/build/iphone/Classes/TiToJS.h:125:9: fatal error: 'JavaScriptCore/TiCore.h' file not found
[TRACE] :  #import "JavaScriptCore/TiCore.h"
[TRACE] :          ^
[TRACE] :  1 error generated.
[ERROR] ** BUILD FAILED **
[ERROR] The following build commands failed:
[ERROR]         CompileC build/Intermediates/HLTesseract.build/Debug-iphonesimulator/HLTesseract.build/Objects-normal/x86_64/TiFile.o Classes/TiFile.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler

Comments

  1. Chee Kiat Ng 2016-08-04

    PRs: https://github.com/appcelerator/hyperloop.next/pull/51 https://github.com/appcelerator/hyperloop.next/pull/50 And you can test easily with this pre-release https://github.com/appcelerator/hyperloop.next/releases/tag/1.2.6_b1
  2. Hans Knöchel 2016-08-04

    PR's (master & 1_2_X) merged. Do we want this in 5.4.0.GA as well?
  3. Josh Longton 2016-08-09

    [~cng] I am not able to run the Tesseract application on a device.

    Tested on

    {noformat} iPhone 6s plus (9.3.1) iPhone 5 (9.1) iPhone Simulator (9.3) 
Mac OSX El Capitan 10.11.6 Studio: 4.7.0.201607250649 
Ti SDK: 5.4.0.v20160809033140 
Appc NPM: 4.2.7 Appc CLI: 5.4.0-40 Xcode 7.3.1 Node: v4.4.4 Hyperloop: 1.2.6 CocoaPods: 1.0.1 {noformat}

    Simulator

    On the simulator the application works just throwing a failed to load error for the language params. {noformat} [ERROR] : failed to load /Users/Josh/Library/Developer/CoreSimulator/Devices/D5EEC5AB-078C-46AA-AC55-05BBBD410CB7/data/Containers/Bundle/Application/FA4E6363-7592-4B2C-BD6D-8425F3B56303/Josh-HyperLoop-Test-app.app/tessdata/ita.special-words [ERROR] Using default language params {noformat}

    Device

    On the device the application throws an application error as soon as OCR this is clicked. {noformat} [ERROR] Cannot find class with name: G8Tesseract [ERROR] Script Error { [ERROR] column = 32; [ERROR] description = "Cannot find class with name: G8Tesseract"; [ERROR] line = 105; [ERROR] message = "Cannot find class with name: G8Tesseract"; [ERROR] name = ClassNotFound; [ERROR] nativeStack = "1 libobjc.A.dylib 0x36e9edff objc_exception_throw + 38\n2 Josh-HyperLoop-Test-app 0x0023ac3d Josh-HyperLoop-Test-app + 1723453\n3 Josh-HyperLoop-Test-app 0x00233b5d Josh-HyperLoop-Test-app + 1694557\n4 JavaScriptCore 0x26e31de3 + 366\n5 JavaScriptCore 0x26bf9d43 + 314\n6 JavaScriptCore 0x26bf856d + 120\n7 JavaScriptCore 0x26ebf393 + 20386\n8 JavaScriptCore 0x26ebf39d + 20396\n9 JavaScriptCore 0x26eba1e1 + 336\n10 JavaScriptCore 0x26e136b7 + 102\n11 JavaScriptCore 0x26bfc9f9 + 344\n12 JavaScriptCore 0x26bfc89d _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 60\n13 JavaScriptCore 0x26dbf73f + 126\n14 JavaScriptCore 0x26f185b7 _ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE + 42\n15 JavaScriptCore 0x26bf4101 + 1408\n16 JavaScriptCore 0x26ebc83d + 9292\n17 JavaScriptCore 0x26ebf39d + 20396\n18 JavaScriptCore 0x26eba1e1 + 336\n19 JavaScriptCore 0x26e136b7 + 102\n20 JavaScriptCore 0x26bfc9f9 + 344\n21 JavaScriptCore 0x26bfc89d _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 60\n22 JavaScriptCore 0x26bfc7b5 JSObjectCallAsFunction + 300\n23 Josh-HyperLoop-Test-app 0x001d9e15 Josh-HyperLoop-Test-app + 1326613\n24 Josh-HyperLoop-Test-app 0x00136c25 Josh-HyperLoop-Test-app + 658469\n25 Josh-HyperLoop-Test-app 0x001d9d0f Josh-HyperLoop-Test-app + 1326351\n26 Josh-HyperLoop-Test-app 0x001d9f9d Josh-HyperLoop-Test-app + 1327005\n27 Josh-HyperLoop-Test-app 0x000b45bf Josh-HyperLoop-Test-app + 124351\n28 Josh-HyperLoop-Test-app 0x000b46ab Josh-HyperLoop-Test-app + 124587\n29 Josh-HyperLoop-Test-app 0x00136c25 Josh-HyperLoop-Test-app + 658469\n30 Josh-HyperLoop-Test-app 0x000b466d Josh-HyperLoop-Test-app + 124525\n31 Josh-HyperLoop-Test-app 0x001da02b Josh-HyperLoop-Test-app + 1327147\n32 Josh-HyperLoop-Test-app 0x001d963d Josh-HyperLoop-Test-app + 1324605\n33 Josh-HyperLoop-Test-app 0x0011b217 Josh-HyperLoop-Test-app + 545303\n34 Josh-HyperLoop-Test-app 0x000d5045 Josh-HyperLoop-Test-app + 258117\n35 Josh-HyperLoop-Test-app 0x0010daef Josh-HyperLoop-Test-app + 490223\n36 Josh-HyperLoop-Test-app 0x0011ae63 Josh-HyperLoop-Test-app + 544355\n37 Josh-HyperLoop-Test-app 0x0010ff9d Josh-HyperLoop-Test-app + 499613\n38 UIKit 0x299495e1 + 80\n39 UIKit 0x29949571 + 64\n40 UIKit 0x29931487 + 446\n41 UIKit 0x29948ec1 + 616\n42 UIKit 0x29948b2f + 646\n43 UIKit 0x2994144f + 642\n44 UIKit 0x299122f1 + 204\n45 UIKit 0x29910937 + 5134\n46 CoreFoundation 0x257a07c7 + 14\n47 CoreFoundation 0x257a03b7 + 454\n48 CoreFoundation 0x2579e71f + 806\n49 CoreFoundation 0x256f10d9 CFRunLoopRunSpecific + 516\n50 CoreFoundation 0x256f0ecd CFRunLoopRunInMode + 108\n51 GraphicsServices 0x2ea66af9 GSEventRunModal + 160\n52 UIKit 0x2997a2dd UIApplicationMain + 144\n53 Josh-HyperLoop-Test-app 0x0009cf3f Josh-HyperLoop-Test-app + 28479\n54 libdyld.dylib 0x375ec873 + 2"; [ERROR] sourceURL = "file:///var/mobile/Containers/Bundle/Application/967340AF-0866-4BDE-AFED-1F86CC245A15/Josh-HyperLoop-Test-app.app/hyperloop/tesseractocr/g8tesseract.js"; [ERROR] } {noformat} *I have attached my application used [here](https://www.dropbox.com/s/34w2fl884ea83m2/Josh-HyperLoop-Test-app.zip?dl=0)*
  4. Lee Morris 2017-03-31

    Closing ticket as fixed, if there are any problems, please file a new ticket.

JSON Source