Categories
english

Zbar support on armv7 and upper

For one of my client project, I needed a QR code reader. I do know that Apple introduced such a reader on iOS 7, but I needed it to run on iOS 6 as well.

Two open-source librairies looked like serious candidates at first:

Zbar

zxing

zxing dropped support for the iOS platform recently. This leaves us with Zbar.

Zbar pre-compiled library does not support modern architectures

However, there is a problem with the Zbar library found in the SDK: it’s been compiled for the armv6, armv7 and i386 architectures only. Therefore, if your application supports more modern architectures like armv7s or arm64, it won’t link with the precompiled library.

Compiling from the source code

The solution is to compile Zbar yourself from the source code, which you can clone using Mercurial. You shall find explanations for Xcode 4 here, and Xcode 5 here.

However, there is an easier way. Someone had the great idea to clone the original Mercurial repository to github and also created a Podspec, so Zbar may be included in your project using Cocoapods.

In your Podfile, write:

pod 'ZBarSDK', '~> 1.3.1'

and voilà! You might still need the documentation for the Zbar SDK.