QR code reader for iPhone

前端 未结 4 1648
太阳男子
太阳男子 2020-12-12 11:51

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

相关标签:
4条回答
  • 2020-12-12 12:07

    Try ZXingObjC working great and easy to integrate.

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

    0 讨论(0)
  • 2020-12-12 12:13

    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
    
    0 讨论(0)
  • 2020-12-12 12:14

    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.

    0 讨论(0)
  • 2020-12-12 12:19

    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 讨论(0)
提交回复
热议问题