开发者

QR code reader for iPhone [closed]

开发者 https://www.devze.com 2023-03-03 10:20 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

开发者_C百科

Closed 1 year ago.

Improve this question

I want to create QR code reader based application.

Using which library, I can create my application ?

Note: I searched in google. Always I am getting zxing. I downloaded the zxing project. But the problem is; I run the application. But it is reading only the Barcodes. There is no option to read QR code.

Please tell me how to do this...

Thanks in Advance.


ZBarSDK is another option. A very capable library.

UPDATE January 2014

Beginning in iOS7, AVCaptureDevice now includes the ability to read barcodes (of all kinds) and return a human readable value. If you're targeting iOS7+, this is the way to go. ZBarSDK is still great for pre-iOS7 support, of course.


AVCaptureMetaDataOutput - Starting from iOS 7

Scan UPCs, QR codes, and barcodes of all varieties with AVCaptureMetaDataOutput, new to iOS 7. All you need to do is set it up as the output of an AVCaptureSession, and implement the captureOutput:didOutputMetadataObjects:fromConnection: method accordingly:

 @import AVFoundation;

 AVCaptureSession *session = [[AVCaptureSession alloc] init];
 AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
 NSError *error = nil;

 AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device
                                                                error:&error];
 if (input) {
     [session addInput:input];
 } else {
     NSLog(@"Error: %@", error);
 }

 AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init];
 [output setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]];
 [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
 [session addOutput:output];

 [session startRunning];

 #pragma mark - AVCaptureMetadataOutputObjectsDelegate

 - (void)captureOutput:(AVCaptureOutput *)captureOutput
         didOutputMetadataObjects:(NSArray *)metadataObjects
              fromConnection:(AVCaptureConnection *)connection
   {
    NSString *QRCode = nil;
     for (AVMetadataObject *metadata in metadataObjects) {
       if ([metadata.type isEqualToString:AVMetadataObjectTypeQRCode]) {
            // This will never happen; nobody has ever scanned a QR code... ever
             QRCode = [(AVMetadataMachineReadableCodeObject *)metadata stringValue];
             break;
          }
      }

     NSLog(@"QR Code: %@", QRCode);
   }

AVFoundation supports every code you've heard of (and probably a few that you haven't):

AVMetadataObjectTypeUPCECode
AVMetadataObjectTypeCode39Code
AVMetadataObjectTypeCode39Mod43Code
AVMetadataObjectTypeEAN13Code
AVMetadataObjectTypeEAN8Code
AVMetadataObjectTypeCode93Code
AVMetadataObjectTypeCode128Code
AVMetadataObjectTypePDF417Code
AVMetadataObjectTypeQRCode
AVMetadataObjectTypeAztecCode


Try ZXingObjC working great and easy to integrate.

As well, you can define the size of the scanner window inside your view.


for your reference you can use webqr.com and it's library you can use for decode the QR code and encoding also . But for different browser like safari, Chrome, IE, Firefox, you can add the plugin for This. Hope so it will help full for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消