[TIMOB-23729] Hyperloop: iOS: Local-embedded frameworks not working with TICORE
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-04T10:13:27.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Hyperloop, iOS |
Labels | n/a |
Reporter | Chee Kiat Ng |
Assignee | Eric Merriman |
Created | 2016-08-04T09:41:35.000+0000 |
Updated | 2017-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 flawlesslyActual 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
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
PR's (master & 1_2_X) merged. Do we want this in 5.4.0.GA as well?
[~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 afailed 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 asOCR 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 0x26e31de3Closing ticket as fixed, if there are any problems, please file a new ticket.