Open-source framework: zxing

Source: Internet
Author: User

Introduction:

The popularity of QR codes is staggering. Now, a QR code is attached to every real advertisement on the corners of the page, prompting users to scan the information and learn more. Zhang Xiaolong said that the entrance to the PC is the search box, the mobile phone entry lies in the QR code.

The QR code solves the problem of entering information on mobile phones. In addition to sighing human intelligence, the QR code is more about how to use this existing technology to meet our application needs.

Of course, the internal algorithm is not covered in this blog. It mainly introduces how to use it.

References:

1: the first article of kaibo: Use of zxing2.0 QR code in xcode4.2

Http://blog.csdn.net/icash/article/details/7727299

2: Problems with zxing in IOS

Http://blog.csdn.net/zzfsuiye/article/details/8244917

3: Enable zxing to support bar code scanning

Http://hi.baidu.com/397362542/item/a574ce39b267fdd12f8ec23b

How to install:

1: The hosting address of zxingwidget is as follows:

Http://code.google.com/p/zxing/downloads/list

2: some files in the library

Not all files are used,

Download zxing2.0, decompress get zxing-2.0 folder, which only keep CPP and iPhone two folders on it.

3: I use workspace to introduce third-party resources.

You can skip the following steps:

4: add the following items to frameworks:

Libzxingwidget.

Addressbook

Addressbookui

Audiotoolbox

Avfoundation

Coremedia

Corevideo

Libiconv. dylib

After completion, such:

5: do not forget to set an audio file when the scan is successful:

widController.soundToPlay = [NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO];

6. Maintain the C ++ mixed compilation mode of the project.

First, perform the following operations:

1. change the name of your delegate file. the M file is. mm (please note that if you rename a file in the project, the file name in the physical path will not be changed, so please change the physical file name)

Change myzxingappdelegate. m

 

Myzxingappdelegate. Mm

2. Change the. M file of the project file you want to use zxing to. Mm.

Myzxingviewcontroller. m

Change

 

Myzxing

Viewcontroller

. Mm

Usage:

7. Download my demo and try it:

Xcode 4.6 ios6.1 passed the test

Demo address: Click here!

Possible problems:

1. if zxing is used in your project, but after xcdoe is upgraded to 4.5, incompatible pointer types sending 'class' (aka 'class * ') appears *') to Parameter of Type 'id <nscopying> 'error. Solution: download the latest zxing version again. You can run the following command to download the latest version: SVN.
Checkout http://zxing.googlecode.com/svn/trunk/ zxing-read-only.

2. If a problem occurs, undefined symbols for Architecture
I386 "STD: String: c_str () const", referenced from ....,

Set C language dialect, C ++ language dialect, and C ++ standard library in your project's apple llvm compiler 4.1-language to the selected value. Reference http://stackoverflow.com/questions/12665457/zxing-in-xcode-4-5-and-ios-6

3. choose a destination with a supported architecture in order to run on this device appears when the compilation is successful on the real machine. Because the iOS device does not support armv7s, you must set ubuntures to armv6, however, you only need to change the valid ubuntures. Do not change the ubuntures. Otherwise, the real machine may not run. Change ubuntures to $ (archs_standard_32_bit) to hit the phone. See http://blog.sina.com.cn/s/blog_90a0ad8d01013uuh.html

4: xcode has been upgraded to 4.6 and zxingsdk cannot be compiled.

The following error message is displayed when no compilation error is declared for the variable (but it is clearly used ):

Member initializer 'bits _ 'does not name a non-static data member or base class

Google has many foreigners, or foreigners have encountered this problem. Then they asked a question. The question and answer address is as follows:

Http://code.google.com/p/zxing/issues/detail? Id = 1494

This section describes how to use-WerrorAnd-Wno-unused-ParameterRemove,

But you only need to remove-WerrorYou can, if
-Wno-unused-Parameter
This also removes the warning that many variables are not used.

At this time, the compilation can be passed, and there are also a few warnings.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.