Skip to content
Kevin Conley edited this page Apr 3, 2015 · 26 revisions

Use the provided template project

If you're starting from scratch, the "Template Framework Project" in this repository provides an example of how to use Tesseract in your iOS projects. It's iOS7 and arm64 ready!

Integrate the framework into an existing project using CocoaPods

CocoaPods

First install CocoaPods; instructions are here: http://cocoapods.org/

Using the latest stable version

Add the following line to your Podfile then run pod install

pod 'TesseractOCRiOS', '4.0.0'

Using the development version

Add the following line to your Podfile then run pod install

pod 'TesseractOCRiOS', :git => 'https://github.com/gali8/Tesseract-OCR-iOS.git'

** WARNING **: This uses the GitHub repository's master branch as the source for the library. This is not based off of any stable Tesseract OCR iOS release.

Importing the tessdata folder

Import your tessdata folder (you can download one for your language from https://code.google.com/p/tesseract-ocr/downloads/list) into the root of your project AS A REFERENCED FOLDER (see below). It contains the Tesseract trained data files. You can add your own trained data files here too.

NOTE: This library currently requires the tessdata folder to be linked as a referenced folder instead of a symbolic group. If Tesseract can't find a language file in your own project, it's probably because you created the tessdata folder as a symbolic group instead of a referenced folder. It should look like this if you did it correctly:

Note how the tessdata folder has a blue icon, indicating it was imported as a referenced folder instead of a symbolic group.

Side note: I (mdenty) used to put TesseractOCR.framework as an embedded framework in my project. Since iOS7 does not support embedded frameworks, I've decided to put TesseractOCR as "normal" framework. My project built and linked without problem, but at runtime I use - (UIImage *)g8_blackAndWhite; method of UIImage (G8Filters) category and I got something like:

reason: '-[UIImage g8 blackAndWhite]: unrecognized selector sent to instance
```

I solved the problem by setting `GENERATE_MASTER_OBJECT_FILE = YES` in the Tesseract OCR IOS.xcodeproj build settings. This should lead to a bit bigger executable file.
_End of side note._