Why I Move From ZXing to ZBar

Nowadays the QRCode are still used in many mobile applications, and iOS applications are no exception to the rule.

In a previous post I already talked about ZXing which is a popular QRCode reader for iOS. Unfortunately since iOS6 I have some trouble with this library regarding the display orientation of its controller. That’s why I searched for (I have found it since then) a more convenient reader which fits perfectly to my needs namely ZBar.

In this post I’m going to explain you briefly why I decided to use ZBar instead of ZXing, and to finish I’ll show you a code comparison between these 2 readers.

Why I Gave Up ZXing?

Before to start, I just want to highlight that ZXing is a nice reader which make his job very well. However It is not very easy to use for beginners (see my tutorial for its installation) and it has been design to work only into the portrait orientation (at least for iOS).

My applications are often designed to be used only into the landscape orientation (for the iPad apps). Until iOS5, even if ZXing didn’t display its controller into the landscape mode, the controller (which display the video) allowed me to scan the QRCode correctly. Now with iOS6 and its new orientation API, the ZXing controller does not display the video and its overlay correctly in this mode and after some searches and tests I didn’t find any solution to fix the problem easily.

ZXing Landscape mode iOS6

Another disadvantage of ZXing is that you need to put your files as Objective-C++ (.mm) and it is very boring because it does not allow you to refactor/maintain your code easily.

These two reasons have led me to change for ZBar, and now we are going to see some code snippets which make the comparison between ZXing and ZBar.

ZXing vs ZBar

In this section I’m going to show you 2 examples: one which use the ZXing the library and the other which use the ZBar reader.

Code for ZXing

Here an object which use the ZXing library:

Code for ZBar

Here the ZBar code snippet:

As you can see, there is no big difference between ZXing and ZBar in their use. Concerning the installation you can take a look at the installation guide, and you’ll see that it is easier to install than ZXing.

Conclusion

To conclude I think than ZBar is a good alternative to ZXing. It is easy to install, it is easy to use and it works perfectly for all of the device orientations. In my point of view if you have any problem with ZXing you should take a look to ZBar.

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 2.75 out of 5)
Loading...

One comment

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. Gabriele · April 25, 2013

    Thank you so much for yours tutorial about ZXing but i’ve a question. how can i use this library?

    there is some documentation about to use this library?