Hey, I have googled a lot and found very less material for how to implement a QR code reader in our iPhone app. Here I have integrated all material and implemented in my project.
So here I am sharing my experience of implementing a QR code reader in our iPhone app using ZBarSDK.
Step 1: Download ZBarSDK from here.
Step 2: Create a new project in xcode and name it as QRscanner.
Step 3: Integrate this ZBarSDK folder in your xcode project by drag and drop on equal level of class folder in left panel in xcode.
Step 4: Add these 7 frameworks in Frameworks folder:
Step 5: Now Go To this link and generate some QR codes.
(to generate QR codes only add the text which you want to attach with QR code at the end of the link (e.g. I have written archana) and press enter, and right click to save this image.)
Step 6: Add these generated QR code's image in iphone library.
Step 7: Now open QRscannerViewController.h in your xcode and write this code:
Step 8: Now open QRscannerViewController.m in your xcode and write this code:
Step 9: Now open QRscannerViewController.xib and design it UI like this:
Step 10: Now make connection of above 2 objects(UITextView and UIButton) with IBOutlet resultTextView and IBAction StartScan.(Refer Step 7 of…)
At last build and run this app.
How to run this app:
Press "START SCAN" button, and as we are running our app in simulator you will get screen like this:
Now press and hold (alt key)+(left click), Photo Album (image gallery, photo library) will open.
Select any QR code image. It will take hardly 2-3 seconds for scanning and finally you will get home screen with scanned data associated with QR code image on text view.
Download source code from here.
So here I am sharing my experience of implementing a QR code reader in our iPhone app using ZBarSDK.
Step 1: Download ZBarSDK from here.
Step 2: Create a new project in xcode and name it as QRscanner.
Step 3: Integrate this ZBarSDK folder in your xcode project by drag and drop on equal level of class folder in left panel in xcode.
Step 4: Add these 7 frameworks in Frameworks folder:
- AudioToolbox.framework
- CoreMedia.framework
- QuartzCore.framework
- SystemConfiguration.framework
- libiconv.dylib
- AVFoundation.framework
- CoreVideo.framework
Step 5: Now Go To this link and generate some QR codes.
(to generate QR codes only add the text which you want to attach with QR code at the end of the link (e.g. I have written archana) and press enter, and right click to save this image.)
Step 6: Add these generated QR code's image in iphone library.
Step 7: Now open QRscannerViewController.h in your xcode and write this code:
#import <UIKit/UIKit.h>
#import "ZBarSDK.h"
@interface QRscannerViewController : UIViewController <UIImagePickerControllerDelegate,ZBarReaderDelegate>{
IBOutlet UITextView *resultTextView;
}
@property (nonatomic, retain) IBOutlet UITextView *resultTextView;
@property (nonatomic, retain) UIImagePickerController *imgPicker;
-(IBAction)StartScan:(id) sender;
@end
#import "QRscannerViewController.h"
@implementation QRscannerViewController
@synthesize imgPicker,resultTextView;
-(IBAction)StartScan:(id) sender
{
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.readerView.torchMode = 0;
ZBarImageScanner *scanner = reader.scanner;
// TODO: (optional) additional reader configuration here
// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
// present and release the controller
[self presentModalViewController: reader
animated: YES];
[reader release];
resultTextView.hidden=NO;
}
- (void) readerControllerDidFailToRead: (ZBarReaderController*) reader
withRetry: (BOOL) retry{
NSLog(@"the image picker failing to read");
}
- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info
{
NSLog(@"the image picker is calling successfully %@",info);
// ADD: get the decode results
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
NSString *hiddenData;
for(symbol in results)
hiddenData=[NSString stringWithString:symbol.data];
NSLog(@"the symbols is the following %@",symbol.data);
// EXAMPLE: just grab the first barcode
// break;
// EXAMPLE: do something useful with the barcode data
//resultText.text = symbol.data;
resultTextView.text=symbol.data;
NSLog(@"BARCODE= %@",symbol.data);
NSUserDefaults *storeData=[NSUserDefaults standardUserDefaults];
[storeData setObject:hiddenData forKey:@"CONSUMERID"];
NSLog(@"SYMBOL : %@",hiddenData);
resultTextView.text=hiddenData;
[reader dismissModalViewControllerAnimated: NO];
}
Step 9: Now open QRscannerViewController.xib and design it UI like this:
Step 10: Now make connection of above 2 objects(UITextView and UIButton) with IBOutlet resultTextView and IBAction StartScan.(Refer Step 7 of…)
At last build and run this app.
How to run this app:
Press "START SCAN" button, and as we are running our app in simulator you will get screen like this:
Now press and hold (alt key)+(left click), Photo Album (image gallery, photo library) will open.
Select any QR code image. It will take hardly 2-3 seconds for scanning and finally you will get home screen with scanned data associated with QR code image on text view.
Download source code from here.


Great stuff, seriously helped me out. But does this actually use the camera outside of the simulator or is this only for a demo with a picker?
ReplyDelete@DrLove: Thanks!!! This will also use camera when you will install this app on device, once test on device, all things will be clear.
ReplyDeleteThis is awesome!
ReplyDeleteThank you for sharing. It's really helpful :)
@Phyllis: Thank you !!! I like to share my experiences :)
ReplyDeleteexcuse me, an 'information.
ReplyDeleteI have been following the tutorial and the application works, just that I have a problem.
After the scan the QR code as output I get the link contained within, for example, whether stored in the QR Code is a link to a video, I don't play the video, but the link returns.
What should I do to play the video, or an image or an mp3?
PS: Sorry for my bad English
@Andrea: If you want to play the video associated with link then just right the code for playing a video in this delegate method - (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: and give the path for video file that link which you have got after scanning.
ReplyDeleteIf any confusion feel free to write here.
Hi, I have a problem integrating the ZBarSDk into my project. The build failed and these 2 errors were returned:
ReplyDelete"_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
objc-class-ref-to-ZBarReaderViewController in QRscannerViewController.o
"_ZBarReaderControllerResults", referenced from:
_ZBarReaderControllerResults$non_lazy_ptr in QRscannerViewController.o
I have already followed the steps by importing "ZBarSDK.h" in the .h file. Please help! Thank you!
I've solved the issue. Thanks for your guide by the way! :)
ReplyDeleteAs mentioned here: http://zbar.sourceforge.net/iphone/sdkdoc/tutorial.html, the frameworks need to be included in the specified sequence.
The package from eSnips (as stated above) also does not include libzbar.a
libzbar.a can be obtained from the original ZBarSDK here: http://zbar.sourceforge.net/iphone
Hi,
ReplyDeleteIm having a slight problem... when i select the image from my gallery, it shows me the image in the app simulator with a window with a "Cancel" and "info" button on the toolbar docked at the bottom.
Now nothing happens. The image doesn't scan, no results are displayed, nothing. Is there supposed to be a button to press to deploy the image or something that I'm missing ???
As of now I just hit cancel after like 5 mins and then go back to the previous screen
@sasha172: If I got your point then for that you have to Press (Alt button + left mouse click) and hold it. It will navigate you to photo gallery of simulator. Is it your solution ?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi,
ReplyDeleteIt chose image from the photo gallery, but it not take the out put of the respected qr code
@gogoi : what ever you want to do after taking the image, do write that in this method - (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info
ReplyDeleteHi
ReplyDeleteFor reading a QR Code Stored in Phone Library, what all lines we have to modify in below link.
It is taking the image from Photo library but no such output is coming
- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info
{
NSLog(@"the image picker is calling successfully %@",info);
// ADD: get the decode results
id results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
NSString *hiddenData;
for(symbol in results)
hiddenData=[NSString stringWithString:symbol.data];
NSLog(@"the symbols is the following %@",symbol.data);
// EXAMPLE: just grab the first barcode
// break;
// EXAMPLE: do something useful with the barcode data
//resultText.text = symbol.data;
resultTextView.text=symbol.data;
@swati: Here i have written my own code for printing the hidden data in QR code on consol. But you can write your code for what do you want after scanning.
ReplyDeleteHi
ReplyDeleteI wanted the hidden QRCode data flash in a text field of an iPhone.Is it possible with the code mentioned above.
we can't download the source code.
please do tell send me another link.
@swati: yes it is possible by above code. Run app and see on consol.
ReplyDelete@swati: The code is downloadable. Just now I have downloaded it.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete@swati: Check your mail. I have sent it.
ReplyDeleteHi Archana,
ReplyDeleteThanks a lot for your co-operation and patience to reply.
Yes i got mail.
One more thing want to clear
Will this application work for ipad application also.
I tried with ipad application and nothing is displaying.
Can you please put some light on this issue.
HI archana......
ReplyDeleteCan u plz send source code to dis mail id pavuluri.anu81@gmail.com
Hi,
ReplyDeleteI have same doubt as swati, please let me know whether it is possible or not .
i am also trying same with ipad simulator.
Thanks in advance
@anusha: source code is already attached in this post "Download source code from here" written in this post.
ReplyDeleteHi,
ReplyDeleteThanks for this great post! Do you know how to remove the info button? We could use the showControls = No but this would hide the cancel button. It looks like we could add our custom button via the overlay function, but I'm not sure how to do that. Any help would be appreciated.
Thanks
Martin
@Mart Coul: Thanks !!! I can help you if you will be more descriptive like What info button you are talking about ? Please describe your problem here.
ReplyDelete@Archana - Thanks for the feedback. When you are in scanning mode, at the bottom there is a toolbar with a cancel button on the left and an info button on the right. I'd like that specific button to be removed. Would you have an idea on the best approach to do that? I would not want to lose the cancel button which is what happens if I put "showControls = No".
ReplyDeleteThanks a lot!
This comment has been removed by the author.
ReplyDelete@Mart Coul: Ok, I got your issue. Actually those are ZBar Controls, So in your code where you are creating the object of ZBarReaderViewController, set the property showsZBarControls as FALSE.
DeleteFor example in my code:
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.showsZBarControls = FALSE;
By writing this both buttons (cancel and info) will be remove and there you can draw your own custom button. Because we can't modify the ZBar SDK files.
Thanks Archana! Yes putting the showsZBarControls = FALSE does work to remove both buttons. But I'm unsure how to add a custom button on that scanning screen. I do add buttons in my others screen and I know how, but I'm not sure how to do it for this one since the ZBar SDK manage that screen. Do you have a sample code for this for me to look at? I've looked on google and could not find an example.
DeleteThanks!
@Mart Coul: For adding custom button on scanning screen, create a button in normal way and then where you are writing reader.showsZBarControls = FALSE;
ReplyDeletewrite this also: reader.cameraOverlayView = (UIView *)myCustomButton;
Thanks a lot Archana! It is working very well!!!! Have a good week end!
DeleteMartin
@Mart Coul: Always WelCome !!!
DeleteArchana Chaurasia, I did the same that Mart Coul, but it dosn't work for me, can you please show an example of it? Thank you very much
DeleteI am having a problem with this implementation. I followed the directions step by step but I am getting the following error:
ReplyDeleteclang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
I have tried searching everywhere that I can find. Does anyone have any idea what the problem could be. I am running XCode 4.4 DP2 and iOS 5.1 trying to run with the simulator and my iPhone 4S. I cannot even get the app to compile
@Archana, thank you so much for sharing this. It works great.
ReplyDeleteI have the same problem as @Mart Coul described, but I can't get it to work. The default buttons are removed, but I can not add my own. Any help would be much appreciated
I've done this:
//remove the default ZBar controls as we will implement our own
reader.showsZBarControls = NO;
//implement our own cancel button
UIButton* backButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[backButton setTag:301];
[backButton addTarget:self action:@selector(scannerButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
reader.cameraOverlayView = (UIView *)backButton;
Cheers,
Vedran
Hey man! Great code, really helpful!
ReplyDeleteWill this work with opening up URL links?
Thanks,
@Archana
ReplyDeleteI have figured out the implementation to URLs. This app and source code works great. However, I am having trouble implementing this to the iPad. Would you happen to know how to deal with this?
Thanks
@Shamsuddin Bhuiyan: Thanks ! and I have also implement it in ipad, and it worked fine. If you have any trouble you share it here and we can figure out it.
ReplyDelete@Archana : I tried implementing this in my universal iOS application and everything went ok until I tried to scan a Page using iPad 3 Camera. The view seems to take only 1/4 of the entire screen of the iPad.
DeleteI tried a lot to sort it myself, but failed. Could you please explain how you obtained the same in iPad.
@Archana
ReplyDeleteI am now a follower of your site. Its a great source for someone who is just learning how to do iOS development.
Anyways, whenever I attempt to run it on the iPad simulator, I get this error output:
2012-05-09 17:16:55.046 QRscanner[1176:10703] UIStatusBarStyleBlackTranslucent is not available on this device.
2012-05-09 17:16:55.049 QRscanner[1176:10703] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'On iPad, UIImagePickerController must be presented via UIPopoverController'
I cannot, for the life of me, figure out what is amiss.
@Archana
ReplyDeleteLooks like it actually works fine in an actual iPad but not on the simulator. Just ran and tested it. Works great. If I wanted to change the dimensions of the scanner, what would I do?
@Archana
ReplyDeleteWill you please guide on bar code scanner in same way..
thank you very much
works fine with qr code that you have given with source code. But doesn't work for other qr codes. It doesn't focus properly.
ReplyDeleteThank you so much!
ReplyDelete@Ajit Satarkar: It also scans bar code.
ReplyDeleteHi , I want to know how to add images to the album ?
ReplyDeleteI tried this path to put the image "/Users/user/Library/Application Support/iPhone Simulator/5.1/Media/PhotoData/AlbumsMetadata" , but no use.
@范凱傑: Check my this post to add photos in image gallay: http://iphonenativeapp.blogspot.in/2011/07/add-images-to-iphone-photo-gallery.html
ReplyDeleteThanks a lot !! I got it !!
ReplyDeleteHi ,
ReplyDeleteI have a problem again , now I can add image to the photo album ,
and follow your steps to decode , but after I choose my QR-image , the screen just show my QR-image , it does not decode the QR-image .
Oh ! it should choose the image twice , but I don't know why , lol
ReplyDelete@ 范凱傑 If my post was helpful for you then join my blog and also you can left the comment on my this post http://iphonenativeapp.blogspot.in/2011/07/add-images-to-iphone-photo-gallery.html
ReplyDeleteHi Archana,
ReplyDeleteI have a problem. After loading the QR code from the library nothing is shown. Can you please let me know if I am doing something wrong. And also the QR code generated is the mirror image. Your help will be appreciated.
Regards,
Lokesh
Hi Archana,
ReplyDeleteI resolved the issue. Actually the QR code generated was not at the center. I created a new QR code and the app is working perfectly. Many thanks for such nice tutorial.
Regards,
Lokesh
could you pls send the QR code generator
Delete@Unknown: Thanks !
ReplyDeleteThanks a lot.. I am following now and hope to learn a lot of things.. Have a great day :)
ReplyDeleteHi, I have a problem with your code. I have 3 errors.
ReplyDeleteUndefined symbols for architecture i386:
"_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
objc-class-ref in ViewController.o
"_ZBarReaderControllerResults", referenced from:
-[ViewController imagePickerController:didFinishPickingMediaWithInfo:] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
why, i don't understand, I am new
Hi Archana,
ReplyDeleteI am sorry to post a question here as i dont know where to post the same.
I need your help. Can you please let me know how to create a grid view like Google Play in iPhone.
Your help is much appreciated
Regards,
Lokesh
Hi Archana, I am not able to download your code it says link broken. I tried using your steps but my imagePickerController:didFinishPickingMediaWithInfo method is not getting called. Can you mail the code to sonuengineer@gmail.com asap. I am in urgent need. Thanks
ReplyDelete@Sanjay Kumar: From my side its working fine, I am able to dounload, but still I am sending you the code on your ID.
ReplyDeleteArchana, first off, a BIG thank you for helping us out. You are such a good teacher!
ReplyDeleteI'd greatly appreciate it if you can help me with my problem, although the others above had the same problem, it is not working for me.
I tried adding a button on my scanning screen, the cameraOverlay screen, but the button shows up on my main screen, the view controller. I have absolutely no idea how to put a button on the camera scanning screen even though I can do it on anything with a .h or .m file. Where do we even implement code for camera scanning screen?
here's my problem.
I implemented this in my viewcontroller.h file:
__________________________________________________
@interface SecondViewController : UIViewController
< ZBarReaderDelegate >
{
UIButton *btnButton;
}
____________________________________________
Then I implemented this for an overlay(in case u need to c):
__________________________________________________
- (UIView*)CommomOverlay {
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
UIImageView *FrameImg = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,480)];
[FrameImg setImage:[UIImage imageNamed:@"newGraphicOverlay.png"]];
[view addSubview:FrameImg];
return view;
}
_______________________________________________
Then I put this in my viewcontroller.m file as
-(IBAction) scanButtonTapped {
// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationPortrait);
ZBarImageScanner *scanner = reader.scanner;
reader.showsZBarControls = YES;
reader.cameraOverlayView = (UIView *)btnButton;
UIButton *btnButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btnButton addTarget:self action:@selector(btnButtonTapped:)forControlEvents:UIControlEventTouchDown];
[btnButton setTitle:@"Show View" forState:UIControlStateNormal];
btnButton.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[self CommomOverlay];
[self.view addSubview:btnButton];
[scanner setSymbology: ZBAR_UPCE
config: ZBAR_CFG_ENABLE
to: 1];
[self presentModalViewController: reader
animated: YES];
reader.cameraOverlayView = [self CommomOverlay];
[reader release];
}
___________________________________________________
As you can see I made the button in the scanButtonTapped because only after the scan button is tapped the second view appears, which is the scanning screen/ overlay screen.
But the button shows up only on the first screen( the screen controlled by the viewcontroller.m and viewcontroller.h).
I don't want the button on the screen which has the scan button though. How do I make sure the button goes on the scanning screen?
Please help as soon as you can, for I'd be greatly indebted to you! I'd also appreciate it if you can provide detailed instructions. Thanks so much in advance!
Hi Archana,really g8 work .I love this blog and there is lot of material to learn.Gud job!!!!!!
ReplyDelete@Unknown : Thanks a lot, I am trying to make it more lovable :)
ReplyDeleteHi,
ReplyDeleteMy image picker controller function is not being called. Can you please tell me why?
This comment has been removed by the author.
ReplyDeletei m running this code on simulator , i'm select the image from the photo library , but after that
ReplyDelete- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info , method is not called ...
One question... how do is create QR code????
ReplyDelete@Danny Alexander Alva Rojas : Follow the step 5. Actually there are many way to create QR codes, one of then I mentioned in Step 5.
DeleteIts as if you read my thoughts about iPad Developer You appear to understand a great deal relating to this, as if you authored it inside it or something like that. I believe you could use a couple of photos they are driving the content home a little, but apart from that, this really is great blog. An excellent read. I'll certainly return.
ReplyDeletehey archana , can u tell me how to create this application for a compnay qr code reader ...
ReplyDeletesend me details on lgaksh@yahoo.com
thanks 4 urs support
@aakash: This will work for scanning any type of QR codes. So no need to create a different application for a company QR code.
DeleteCan we fetch image from library instead of camera, so that we can test it on simulator.
ReplyDeletePlease guide me, if it is possible. Thanks in advance.
Please reply to randeep.stpl@gmail.com and also tell me the way to download this code.
ReplyDeleteThanks.
@Randeep Singh : Yes you can pick the image from library by setting the source of image picker as we will set : UIImagePickerControllerSourceTypePhotoLibrary OR UIImagePickerControllerSourceTypeSavedPhotosAlbum.
DeleteAs mention below:
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum
Archana mam please tell how can i do this.
DeleteThank u mam, but i wanted to ask whereto change it.
ReplyDelete-(IBAction)scan
{
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.allowsEditing = YES;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagePickerController animated:YES];
[imagePickerController release];
// [alert dismissWithClickedButtonIndex:0 animated:YES];
NSLog(@"Gallery");
}
-(void)imagePickerController:(UIImagePickerController *)reader didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[self scanCode];
image1 = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
imageView.image=image1;
[self dismissModalViewControllerAnimated:YES];
NSLog(@"the image picker is calling successfully %@",info);
// ADD: get the decode results
id results = [info objectForKey: ZBarReaderControllerResults];
NSLog(@" results:%@", results);
ZBarSymbol *symbol = nil;
NSString *hiddenData;
for(symbol in results)
hiddenData=[NSString stringWithString:symbol.data];
NSLog(@"the symbols is the following %@",symbol.data);
// EXAMPLE: just grab the first barcode
// break;
// EXAMPLE: do something useful with the barcode data
//resultText.text = symbol.data;
//resultTextView.text=symbol.data;
NSLog(@"BARCODE= %@",symbol.data);
NSUserDefaults *storeData=[NSUserDefaults standardUserDefaults];
[storeData setObject:hiddenData forKey:@"CONSUMERID"];
NSLog(@"SYMBOL : %@",hiddenData);
result.text=hiddenData;
[reader dismissModalViewControllerAnimated: NO];
}
I did this way, but the results(id) shows null.
Please tell where i am getting wrong.
Then you have to check the image which you are scanning. I that image is a correct QR code or just a normal image.
Delete[self scanCode]; what is this method contain can you send the code
Delete@Archana: Hii.. if, you can please send me the code to my mail id:(rswalia1985@gmail.com), it is not downloading here. And please tell me that where i need to put that code(fetch image from library) in your code or the Zbar sdk. Please guide me if you can and i am thankful to you for your till cooperation.
ReplyDeletePlease check your mail.
DeleteI am having problem similar to some others. I am using 4.5 and can get the events to occur as predicted. I create QR Codes, save them to Photo Library, Load them in, but nothing occurs after that. The program simply stalls. And....the images are being scaled larger that the viewport. I even size them down to below 500x500 but inside the QRScanner, they appear scaled up 2-3 times that. HELP!
ReplyDeleteI'm having a problem with the Delegate not being called once the reader gets focus. Could you send the source code to me? I'm unable to download it from the linked page.
ReplyDeletelemmings@gmail.com
Thanks!
Hi Archana,
ReplyDeleteI need help in creating a excel file from sql data. Can I get some help from you if you have any knowledge about this.
Regards,
Lokesh
The content is good and very informative and I personally thank you for sharing the iphone and qr code articles.
ReplyDeleteBarcode Networking
I have followed every word in the tutorial above, the only line of code i remove is [reader release]; as it was generating error in my iOS 6 simulator. Now, the problem is the app works until when it loads the image, then it doesnt display the results of the QR code. Any help? Much appreciated
ReplyDeleteThanks for sharing your knowledge Archana!
ReplyDeleteIf I run the program in iPhone Simulator, it runs perfectly fine. But when I try to run it on Ipod 4g, I get the following error:
Apple Mach-O Linker Error
Ld /Users/ .... /ZBarSDKImplementation-gwadphibgtfgvmabhleptfjbxqwc/Build/Intermediates/ZBarSDKImplementation.build/Debug-iphoneos/ZBarSDKImplementation.build/Objects-normal/armv7s/ZBarSDKImplementation normal armv7s
cd "/Users/.../ZBarSDKImplementation"
setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -L/Users/..../Xcode/DerivedData/ZBarSDKImplementation-gwadphibgtfgvmabhleptfjbxqwc/Build/Products/Debug-iphoneos "-L/Users/..../ZBarSDKImplementation/ZBarSDKImplementation/ZBarSDK" -F/Users/... /Xcode/DerivedData/ZBarSDKImplementation-gwadphibgtfgvmabhleptfjbxqwc/Build/Products/Debug-iphoneos -filelist /Users/..../Xcode/DerivedData/ZBarSDKImplementation-gwadphibgtfgvmabhleptfjbxqwc/Build/Intermediates/ZBarSDKImplementation.build/Debug-iphoneos/ZBarSDKImplementation.build/Objects-normal/armv7s/ZBarSDKImplementation.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=5.1 -liconv -framework QuartzCore -framework CoreVideo -framework CoreMedia -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -lzbar -o /Users/.../Developer/Xcode/DerivedData/ZBarSDKImplementation-gwadphibgtfgvmabhleptfjbxqwc/Build/Intermediates/ZBarSDKImplementation.build/Debug-iphoneos/ZBarSDKImplementation.build/Objects-normal/armv7s/ZBarSDKImplementation
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/.../ZBarSDKImplementation/ZBarSDKImplementation/ZBarSDK/libzbar.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
FYI...I am using ZBarSDK 1.2 and I am following to the documentation on: http://zbar.sourceforge.net/iphone/sdkdoc/ in order to make a working app to scan QR codes. I am using Xcode 4.5 to write the code.
Despite the fact that I go though the steps religiously, I run into the above mentioned error.
Also, I am not able to download your source code. Can you please check the link?
Thanks!
Dear Archana Chaurasia, thanks for sharing your knowledge and your blog.
ReplyDeleteI am facing some problem after integrating ZBarframework for scanning QRCodeRead on my apps. My client wants, QRCode Scanner will be in a fixed frame and must not be a PresentModalView. Then I write code for fixed frame QRCode Scanner and adding reader.view on self.view, but it not working as presentModalViewController:reader. I don't know what is my fault and can't solve this problem. I provide my code bellow and Sorry for my bad English.
*After integrating this code working fine.
- (IBAction) scanButtonTapped
{
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
ZBarImageScanner *scanner = reader.scanner;
[scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0];
[self presentModalViewController:reader animated:YES];
[reader release];
* But this code not working, just showing a green box which focus QRCode but doing nothing.
- (IBAction) scanButtonTapped
{
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
reader.showsCameraControls = NO;
reader.showsZBarControls = NO;
[reader setWantsFullScreenLayout:NO];
reader.showsHelpOnFail = NO;
reader.showsZBarControls = NO;
[reader.view setFrame:CGRectMake(20, 134, 280, 202)];
ZBarImageScanner *scanner = reader.scanner;
[scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0];
[self.view addSubview:reader.view];
[reader release];
}
Please help me and give me a solve to get out from here...thanks at advance...
Have a good day!
hello Archana..... its not working for other qrcode..... and also not working for second time of same qrcode.... can u plz help me yaar.....
ReplyDeletehello archana.... not working for other qrcode..... and not working for second time for u given qrcode... can u help me plz....
ReplyDeletehow can i download demo.
ReplyDeletePlease send code to this mail sk.ijaz@gmai.com
ReplyDeleteThis does not seem to work in simulator .. ? I havent tested this on the device .But doesnt seem to work on the simulator.
ReplyDeleteHi,
ReplyDeleteI m using zbarsdk to scann barcode, its working good,but after alert of upc code how to use it in app to proceed further
thanks
nice tutorial .
ReplyDeleteThanks
Thank you a lot!! Archana.. for your time.
ReplyDeleteI used Zxing lib for scanning QR code, was looking for ZBar, I found your tutorial is straightforward, going to give it a shot this morning!! and let you know.
I do share my knowledge as well, you may like to have look at here "http://www.rdcworld-iphone.blogspot.in"
Please! keep sharing this. be social :)
Regards,
RDC
I found one issue, not very important, but maybe could be easily fixed. When I check the option to automatically reconnect, and phone BT is turned off, or phone is taken away from the tablet and there is no connection, tablet power consumption is quite high
ReplyDeletei phones
Hi Archana,
ReplyDeleteThe example given is simple and straightforward.I tried with the steps but i Guess my didFinishPickingMediaWithInfo is not get called,Can you please mail the source code as am unable to download from the Link provided
could you please send the working code to mail id datchayan.sp@gamil.com.
ReplyDeleteHi arachana , could you please explain how to scan the QR code in device
ReplyDeletePlease send demo to this mail anovoselskiy@alteso.com
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi,
ReplyDeleteI am using z bar SDK for iphone to scan QR code ,by default scanning camera is back camera but I want scan QR code from rear camera so how can enable rear camera of iphone using Zbar SDK version 1.2.
Archu you rock !!! great work....
ReplyDeletehi archana,
ReplyDeleteeverything is fine but i selected the image from library. App is not working.
And also i got this error "linker command failed with exit code 1 (use -v to see invocation)" when i tried to install application in device.Please send me the code to my mail (naveen.medeti@gmail.com)
was very useful. great work
ReplyDeletebuy cheap smartphones project by drag and drop on equal level of class folder in left panel in xcode.
ReplyDelete