[iphone][ScanTest] now builds again. Had some minor small problems
[zxing.git] / iphone / README
1 Zxing for iphone is a sub-project of zxing project partially maintened by 
2 independent developers. As of 2nd of June 2010, it contains 3 iPhone projects:
3   - BarCodes: Original zxing iPhone app. Available on app store. However, the code is cirrently maintained
4   - ZXingWidget: a Library that can be included in any iPhone app
5   - ScanTest: a simple test app for ZXingWidget
6
7
8 How to include ZXingWidget in a easy and clean way:
9 ====================================================
10
11   1. Locate the "ZXingWidget.xcodeproj" file under "`zxing/iphone/ZXingWidget/`". Drag ZXingWidget.xcodeproj and
12      drop it onto the root of your Xcode project's "Groups and Files"  sidebar.  A dialog will
13      appear -- make sure "Copy items" is unchecked and "Reference Type" is "Relative to Project"
14      before clicking "Add".    
15    
16   2. Now you need to link the ZXingWidget static library to your project.  Click the "ZXingWidget.xcodeproj" 
17          item that has just been added to the sidebar.  Under the "Details" table, you will see a single
18          item: ZXingWidget.a.  Check the checkbox on the far right of ZXingWidget.a.
19   
20   3. Now you need to add ZXingWidget as a dependency of your project, so Xcode compiles it whenever
21          you compile your project.  Expand the "Targets" section of the sidebar and double-click your
22          application's target.  Under the "General" tab you will see a "Direct Dependencies" section. 
23          Click the "+" button, select "ZXingWidget", and click "Add Target"
24   
25   4. Finally, we need to tell your project where to find the ZXingWidget headers.  Open your
26          "Project Settings" and go to the "Build" tab. Look for "Header Search Paths" and double-click
27          it.  Add the relative path from your project's directory to the
28          "zxing/iphone/ZXingWidget/Classes" directory. Make sure you click the checkbox "recursive path" !
29  
30   5. Ultimately you need to make a tweak so that ZXing actually decodes barcode. In target section, double
31      click on your project target, and go to the build tab. Look for the "Exported Symbols Files" and
32      double-click on it. Att the relative path to the exportList files in "/zxing/iphone/ZXingWidget/exportList".
33      This will tell the linket to actually link with some key classes so that this code registers the necessary
34      decoders.
35  
36   6. You're ready to go. Just #import <ZXingWidgetController.h> from anywhere and it should work !
37
38 Know issues for above steps to include:
39 ======================================
40   - It can happen that when trying to build your own project with ZXoingWidgetController you get linker errors like 
41     "undefined reference to". If this error looks like a c++ undefined reference, then renaming main.m into main.mm (Objectice-C++ source suffix)
42     may fix the problem
43   
44   - If you have building error like " ... : No such file or directory", then it is a classical error, it means that the path to includes is not well
45     specified. The best way to fix this is to look at the Build Command that failed. To do that, click on the lower right corner of your XCode project,
46     you should see the build command that failed. Click on it and expand it by cliking on the "more" symbols that just appeared. This will make appear
47     the exact command line instruction that is ran and fails. You can then make sure that the Header search path you specified is there, and you can also
48     copy/paste this line into your terminal and try to see if you can reproduce/fix the error by adding the right path to the compiler. Once is is fixed,
49     you should have an idea of what's the problem and accordingly modify your Header Search Path.
50