Skip to content

Creating customized build

juraskrlec edited this page Jul 10, 2017 · 2 revisions

Creating customized build of BlinkID SDK

If your final app size is too large, you can create a customised build of MicroBlink.framework and MicroBlink.bundle which will contain only features and resources that you really need.

In order to create customised build of BlinkID SDK, you first need to download the static distribution of BlinkID SDK. A valid production licence key is required in order to gain access to the download link of BlinkID SDK static distribution. Once you have a valid production licence key, please contact our support team and ask them to provide you with the download link. After they give you access to the static distribution of BlinkID SDK, you will be able to download it from you account at MicroBlink Developer Dashboard.

The static distribution of BlinkID SDK is a large zip file (several hundred megabytes) which contains static libraries of BlinkID SDK's native code, all assets and resources and a script which will create the customised build for you.

Prerequisites for creating customised build

In order to create customised build of BlinkID SDK, you will need following tools:

  • XCode and latest iOS SDK
  • CMake - you can install it from Homebrew with brew install cmake, or you can download it from official page
    • please note that command-line version of CMake is required, so if you have downloaded CMake from official page, make sure you install command-line support as well

Steps for creating customised build

  1. Obtain the static distribution of BlinkID SDK by contacting us
  2. Download the zip from link that you will be provided
  3. Unzip the file into an empty folder
  4. Edit the file enabled-features.cmake
    • you should enable only features that you need to use by setting appropriate variables to ON.
    • the list of all possible feature variables can be found in features.cmake
      • for each feature_option command, first parameter defines the feature variable, and the second is the description of the feature, i.e. what it provides. Other parameters are information for script to work correctly.
    • you should not edit any file except enabled-features.cmake (except if instructed so by our support team) to ensure creation of customised build works well
  5. Open terminal and navigate to folder with zip's contents.
  6. Execute command ./create-custom-build.sh and select whether you want static or dynamic frameowk.
    • when asked, enter s to build static framework or d to build dynamic framework
  7. After several minutes (depedending of CPU speed of your computer), customised build will appear in the Release folder. Use that bundle and framework in your app instead of default one.

Warning:

Attempt to use feature within your app which was not enabled in customised build will cause a linker error when linking against the customised framework.

Troubleshooting:

Getting unrecognized selector sent to instance when using customised static framework, while everything works OK with dynamic framework

This happens when your app has not been linked with -ObjC flag against static framework. The problem is related to using Objective C categories within static library which are thrown away by linker. You can see more information in official Apple documentation.

App crashing when scanning starts with log message Failed to load resource XX. The program will now crash.

This means that a required resource was not packaged into final app. This usually indicates a bug in our script that makes the customised build. Please contact us and send your version of enabled-features.cmake and crash log.

CMake error while running script.

You probably have a typo in enabled-features.cmake. CMake is very sensitive language and will throw an non-understandable error if you have a typo or invoke any of its commands with wrong number of parameters.

Linker error while running the script.

This sometimes happens when XCode's link time optimizer runs out of memory. Usually running the script again solves the problem. Please reboot your Mac if this keeps happening.

Keeping only FEATURE_MRTD creates rather large MicroBlink.bundle

FEATURE_MRTD marks the MRTD recognizer. However, MRTD recognizer can also be used in Templating API mode where non-MRZ data can be scanned. To perform OCR of non-MRZ data, a rather large OCR model must be used, which supports all fonts. If you only plan to scan MRZ part of the document, you can edit the features.cmake in following way:

  • find the following line:
feature_resources( FEATURE_MRTD model_mrtd model_general_blink_ocr model_micr model_arabic )
  • keep only model_mrtd in the list, i.e. modify the line so that it will be like this:
feature_resources( FEATURE_MRTD model_mrtd )

This will keep only support for reading MRZ zone in OCR - you will not be able to scan non-MRZ data with such configuration using MRTD recognizer, however you will reduce the MicroBlink.bundle and then final app size by more than 4MB.

More information about OCR models in FEATURE_MRTD
  • model_mrtd is OCR model for performing OCR of MRZ zone
  • model_arabic is OCR model for performing OCR of digits used in arabic languages - text scanning is not supported
  • model_micr is OCR model for performing OCR of Magnetic Ink Characters
  • model_general_blink_ocr is OCR model for performing general-purpose OCR. This model is usually required for performing OCR of non-MRZ text on documents.
Clone this wiki locally