Giter Site home page Giter Site logo

barcodescanner's People

Contributors

3lvis avatar algrid avatar canaksoy avatar carlbrusell avatar devxsby avatar ecompton3 avatar ecoopnet avatar frederic-adda avatar gbreen12 avatar harmoniqpunk avatar haroldogtf avatar holgerkrupp avatar ivanicspeter92 avatar jeryrazakarison avatar jkates1 avatar katerinapetrova avatar logansease avatar mthole avatar mudassir168 avatar nashby avatar onmyway133 avatar prcodes avatar ramongilabert avatar ryu0118 avatar seasox avatar tapwork avatar vadymmarkov avatar zenangst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

barcodescanner's Issues

Swift 4

I've updated the BarcodeScanner Framework and the Example project to Swift 4 with Base SDK 11 and changed the deployment target to iOS 10.3 (since anything less than 10.3 has less than a 9% market share).
I've also added support for all orientations and fixed a bug where the Header would disappear if the rotation was changed.
I also added all the new barcode types to the metadata array.
I also added support for iPhone and iPad device.

I also took the liberty of making some code better.

I've tested all the barcode types and general stability of the framework and example project.

Would you like me to submit a Pull Request to add all these features to your Scanner?

After using `BarcodeScannerController`, iOS control panel flashlight icon gets disabled?

REPRO STEPS:

  1. open BarcodeScannerController
  2. click the flash
  3. leave the scanner
  4. slide up on iOS control center

ACTUAL:
flashlight symbol is greyed out!
image

EXPECTED:
not greyed out

Code we use to call it:


let barcodeController = BarcodeScannerController()
        barcodeController.codeDelegate = self
        barcodeController.errorDelegate = self
        barcodeController.dismissalDelegate = self

 appDelegate = UIApplication.shared.delegate as! AppDelegate
            if UIDevice.current.orientation == UIDeviceOrientation.landscapeLeft {
                appDelegate.barCodeScannerOrientation = .landscapeRight
            } else {
                appDelegate.barCodeScannerOrientation = .landscapeLeft
            }
            
            barcodeController.reset()
            
            if let strongself = self {
            
                if AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) ==  AVAuthorizationStatus.authorized {
                    // Already Authorized
                    strongself.present(barcodeController, animated: true, completion: nil)
                } else if AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) ==  AVAuthorizationStatus.notDetermined {
                    AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo, completionHandler: { (granted: Bool) -> Void in
                        if granted == true {
                            // User granted
                            DispatchQueue.main.async {
                                strongself.present(barcodeController, animated: true, completion: nil)
                            }
                        }
                    })
                } else if AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) ==  AVAuthorizationStatus.denied {
                    let alertController = UIAlertController(title: "Camera Access",
                                                            message: "The camera permission was not authorized. Please enable it in Settings to continue.",
                                                            preferredStyle: .alert)
                    
                    let settingsAction = UIAlertAction(title: "Settings", style: .default) { (alertAction) in
                        if let appSettings = NSURL(string: UIApplicationOpenSettingsURLString) {
                            UIApplication.shared.openURL(appSettings as URL)
                        }
                    }
                    alertController.addAction(settingsAction)
                    
                    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
                    alertController.addAction(cancelAction)
                    
                    strongself.present(alertController, animated: true, completion: nil)
                }
            }

iPhoneX layout issue (Close button)

In portrait on iPhoneX, the header view with the close button and title label are too close to the notch. There's very little of the close button that is a tappable target as a result. Looks like it needs to be refactored to use safe areas.

scan barcode position

Is there any method to change the scan position from center area to top or bottom?

Do not add subviews directly to the visual effect view itself, instead add them to the contentView

I'm trying to read barcodes with the library but when I try to open the scanner with ios 11 I get this error and the app breaks:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<UILabel: 0x1014a97d0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1c02936a0>> has been added as a subview to <BarcodeScanner.InfoView: 0x1015780d0; baseClass = UIVisualEffectView; frame = (0 0; 0 0); layer = <CALayer: 0x1c4226100>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'

I'm using iOS 11 Beta 4
The library version is 2.1.1

Swift 3.2 Crash

Hi, since i update to xcode 9, i have this crash when open scanner :

'<UILabel: 0x15fe958c0; frame = (0 0; 0 0); userInteractionEnabled = NO; animations = { contentsMultiplyColor=<CABasicAnimation: 0x1c023b100>; }; layer = <_UILabelLayer: 0x1c409d920>> has been added as a subview to <BarcodeScanner.InfoView: 0x15fe948a0; baseClass = UIVisualEffectView; frame = (0 0; 0 0); layer = <CALayer: 0x1c4236300>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'


I fix this issue by changing

[label, imageView, borderView].forEach {
self.contentView.addSubview($0)
}

Should i submit PR for this ?

Header Color

I need to change the color of the header. I don't think it's publicly available in Config.
For what I understood, it is the HeaderView

Navigation bar not displayed when scanner presented modally

I have been successfully using the scanner by pushing it on to the navigation stack. Now however I would like to present it. Strangely the built-in navigation bar is hidden. It seems like the isBeingPresented check is not returning the correct result. The navigation bar does show but once the modal animation has completed and the bar has reached the top of the screen it disappears. I have pasted my code below.

        // Configure barcode scanner
        let controller = BarcodeScannerController()
        controller.codeDelegate = self
        controller.dismissalDelegate = self
        controller.errorDelegate = self
        controller.hidesBottomBarWhenPushed = true
                
        // Set strings
        BarcodeScanner.Info.loadingText = NSLocalizedString("Retrieving code...", comment: "")
            
        // Display scanner
        navigationController?.present(controller, animated: true, completion: nil)

Is there a way I can manually set the navigation bar visibility?

image not found

Getting this error :::::
dyld: Library not loaded: @rpath/BarcodeScanner.framework/BarcodeScanner
Referenced from: /var/containers/Bundle/Application/154B00B7-2208-42B6-840F-6F02FCCA5AE2/(AppName).app/(AppName)
Reason: image not found

I'm using Xcode 8.2.1 and the barcodescanner pod version latest.....
pod installation was successful.. pod version is 1.2.0....... can you address this issue ASAP

Carthage releases

Guys,

I was wondering why you are not create release tags on the repository. In theory, the last version released was 2.0 on Oct 13 2016 and the repository is quite active.

Is there any reason for this?

Preview flattened when in container

Hi,

I would like to put the BarcodeScannerController inside a ContainerView (in order to have the Barcode scanner on the top half of the screen, and a tableview with the list of scanned barcode on the bottom half of the screen).

But when I tries to embed the BarcodeScannerController in a container which sizes the half of the height of the screen, the preview is flattened. Do anyone have an idea of how to fix it?

Thank you a lot,

Jery

Manual Installation

CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

Chinese Simplified (Zh-Hans) Localization

"SCAN_BARCODE_TITLE" = "扫描条形码";
"BUTTON_CLOSE" = "关闭";
"BUTTON_SETTINGS" = "设置";
"INFO_DESCRIPTION_TEXT" = "将条形码放置在窗口内进行扫描,将自动搜索。";
"INFO_LOADING_TITLE" = "寻找你的产品…";
"NO_PRODUCT_ERROR_TITLE" = "没有发现产品。";
"ASK_FOR_PERMISSION_TEXT" = "你必须在设置里面打开相机权限才可以扫描条码。";

Close any time.

Controller.dismiss not working

I have the below set up to dismiss the controller once bar code has been scanned but the controller stays at "Looking for your product..." animation:

extension ViewController: BarcodeScannerCodeDelegate {
    
    func barcodeScanner(_ controller: BarcodeScannerController, didCaptureCode code: String, type: String) {
      
        controller.dismiss(animated: true)

    }
}

I am running Xcode 9.1 on device with iOS 11.1.

Do not add subviews directly to the visual effect view itself.

Pod crashes app on ios 11

I think line 67 in InfoView.swift is at fault here !?

Example code:

            self.barcodeScanner = BarcodeScannerController()
            self.barcodeScanner?.codeDelegate = self
            self.barcodeScanner?.errorDelegate = self
            //self.barcodeScanner?.view.subviews[0].isHidden = true
            
            return barcodeScanner

Console error:

*** Assertion failure in -[BarcodeScanner.InfoView _addSubview:positioned:relativeTo:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3683.300.2/UIVisualEffectView.m:1364

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<UILabel: 0x127d23f60; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1c40992d0>> has been added as a subview to <BarcodeScanner.InfoView: 0x127d51a10; baseClass = UIVisualEffectView; frame = (0 0; 0 0); layer = <CALayer: 0x1c4227d40>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'

*** First throw call stack:
(0x184f9d858 0x183774528 0x184f9d72c 0x185ad2280 0x18be0d26c 0x10344d2c8 0x10343fb4c 0x10344d3f8 0x10398bf7c 0x1037bc73c 0x10344d0b4 0x10344d424 0x10344cd14 0x10343b1d0 0x10343f204 0x10343fe44 0x18b7ab6bc 0x18b7ab294 0x18b92fafc 0x18b8529d0 0x18b8525f0 0x18b8524f8 0x18b7a8a64 0x1887816e4 0x18878579c 0x1886f83f8 0x18871de44 0x18871ec68 0x184f43a6c 0x184f41514 0x184f419f8 0x184e60280 0x186971f94 0x18b80f0f0 0x102cd8cc0 0x183c51e40)

libc++abi.dylib: terminating with uncaught exception of type NSException

Force orientation and capture layer

Is it possible to force landscape or portrait?
Also, is it possible to specify the layer capture for barcode (as seen in the image below)?

Tks!

example_mobile

3 lines infoview label

On smaller iPhones, the big texts does not fit on the numberOfLines set.

For now, we can set the numberOfLines parameter to 3.

It would be nice later to do a adjustment using autolayout to support any text size.

Retrieving an UIImage, possibly with a pinch enabled window

Great library, congrats!

How can I retrieve a UIImage, for instance a string like r2Us1gf907 on a box.

If we can manipulate the auto focusing window to detect strings, that's awesome, but I do not know how.

If we can not do that, how can we add something like this?

And lastly, how can I retrieve the UIImage after the focus and taking the shot?

We may have to add a camera button for it probably, since the library auto captures the barcodes by itself.

OR

We can make it auto capture enabled for alphanumeric strings, but I do not know how yet.

Hope to see wisdom below.

Thanks!

Crashes on simulator launch

Not a huge issue, but just want to make sure this doesn't happen on production devices with no camera (are there any? ipod?)

seems this line:

  lazy var captureDevice: AVCaptureDevice = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo)

is causing the EXC_BAD_ACCESS error crash when pressing the "Scan" button:

fatal error: unexpectedly found nil while unwrapping an Optional value
2017-10-02 10:35:40.653827-1000 BarcodeScannerExample[34615:904682] fatal error: unexpectedly found nil while unwrapping an Optional value

High CPU usage

Hello!

Thanks for library!
I noticed a high load on the processor. This happens when I close the controller.
Please check it.

Alexandr.

2016-10-31 9 36 56

QR Code reader

It would be nice if the interface (target area, icons) were adapted to QR codes too.
Just a suggestion.

Info View customization

Hello, is there a way to customize the info view? Change the background color, hide it and other stuff like this.

Delegate to handle scanned barcode is called more than once!?

When using the following code fragment:
func barcodeScanner(_ controller: BarcodeScannerController, didCaptureCode code: String, type: String) { print("\(type(of: self)).barcodeScanner(,code=\(code),type=\(type)") let delayInSeconds = 0.5 var segueId = "" DispatchQueue.main.asyncAfter(deadline: .now() + delayInSeconds) { //My scanned code handling goes here ... } }

I am getting the following output:
HomeScreenViewController.barcodeScanner(,code=Endoscope,type=org.iso.QRCode HomeScreenViewController.barcodeScanner(,code=Endoscope,type=org.iso.QRCode HomeScreenViewController.barcodeScanner(,code=Endoscope,type=org.iso.QRCode HomeScreenViewController.barcodeScanner(,code=Endoscope,type=org.iso.QRCode HomeScreenViewController.barcodeScanner(,code=Endoscope,type=org.iso.QRCode HomeScreenViewController.barcodeScanner(,code=Endoscope,type=org.iso.QRCode

where I only expect one call! I configure the scanner according to the delegate's example.

How can I prevent this from happening, since I want to call a performSegue(..) call, depending on
the scanned-code. What I see now is that 6 times a specific performSegue() will be called, giving me 6 times the same ViewController on my NavigationController-stack?

Anybody now a means how to prevent the barcodeScanner-delegate callback from being called more than one time?

Do Not add Subviews directly to the Visual Effect View, instead add them to the ContentView - Swift 4 ISSUE XCODE 9

I integrated the BarcodeScanner POD in the project and it runs perfectly on iOS 10. However on iOS 11 its giving me the below error. Please update your pod to work with Swift 4.

2017-10-15 17:11:16.427039+0530[1797:1731968] [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-10-15 17:11:16.428545+0530[1797:1731968] [MC] Loaded MobileCoreServices.framework
2017-10-15 17:11:17.538814+0530[1797:1731968] *** Assertion failure in -[BarcodeScanner.InfoView _addSubview:positioned:relativeTo:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3694.4.18/UIVisualEffectView.m:1464
2017-10-15 17:11:17.543583+0530[1797:1731968] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<UILabel: 0x127dc0580; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1c0481540>> has been added as a subview to <BarcodeScanner.InfoView: 0x127d250a0; baseClass = UIVisualEffectView; frame = (0 0; 0 0); layer = <CALayer: 0x1c043c8e0>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'
*** First throw call stack:
(0x182c9fd38 0x1821b4528 0x182c9fc0c 0x18362ec24 0x18c73c7a8 0x10595cda4 0x10594dadc 0x10595ced4 0x106263a50 0x106076b94 0x10595cb20 0x10595cf00 0x10595c650 0x1059487f4 0x10594d194 0x10594dd7c 0x18c0afbfc 0x18c0af7d4 0x18cc3c8b0 0x18c3f23b0 0x18c422034 0x18c424f54 0x18c425488 0x18c424ea4 0x18c18f55c 0x104b40ea8 0x104b41074 0x18c0e420c 0x18c0e418c 0x18c0cef4c 0x18c0e3a80 0x18c0e35a0 0x18c0dea70 0x18c0b0078 0x18c9eff98 0x18c9f2408 0x18c9eb574 0x182c48358 0x182c482d8 0x182c47b60 0x182c45738 0x182b662d8 0x1849f7f84 0x18c113880 0x104994b8c 0x18268a56c)
libc++abi.dylib: terminating with uncaught exception of type NSException

Rotation and Split View on iPad don't work

When rotating an iPad with the BarcodeScanner open, the frame isn't changed correctly. This leaves black space around the camera view, as well as leaving the image unrotated.

Essentially, every time the frame changes, the Barcode Scanner does not change frame, causing it to look wrong.

Change color of Navigationbar

Hi,
my app uses a dark theme with an custom color UINavigationBar. Is there a way to change the color of the navigation bar which is visible while scanning?

Updated Version of this library to 3.0.0. Getting errors on compile time.

I have just updated all the pods of my project by hitting pod update command.
all the libraries are updated to latest version.

The problem is this library has version 2.0.0 (older) which is updated to 3.0.0 (newer).
And getting compile time errors.

I am using latest Xcode Version 9.0 (9A235).

What should I do?

controller.reset() not working as expected

After scanning a barcode the "Looking for your product..." animation will not dismiss. Based on the below code the assumed behavior would be that the scanner would reset so that I can scan another code. Am I missing something?

func barcodeScanner(_ controller: BarcodeScannerController, didCaptureCode code: String, type: String) {
    print("Capture Successful")
    print("code: \(code): type: \(type)")
    
    capturedCodes.insert(code)
    
    controller.reset(animated: true)
  }

Also, using controller.resetWithError(message: String?) does not seem to work correctly either. The error appears briefly but then changes to the "Looking for your product..." animation and remains as describe above.

Cocoapods not support?

When I trying to install, it show [!] Unable to find a specification for BarcodeScanner

Corner Radius for barcode box animation

Just thought I'd make you aware, that for some reason the square that is used for the loading animation does not display it's corner radius correctly. It is no big deal, and is purely cosmetic but I thought I'd highlight it. I have tried increasing the corner radius myself, but it does not seem to have any effect.

Cocoapods install failed

Hi
I tried to install this lib via Cocoapods using the command

pod 'BarcodeScanner'

as explained in the help, but I get the following message error in the Terminal running pod install:

Unable to find a specification for BarcodeScanner

Thanks for your help

Custom color barcode

I can't scan code with custom color like blue bars on white background. Here is an example:
gum-xylitol-blueberry-mint-hu-58g-2

Feature request

Any plans to support MSI-PLESSEY?
It is still widely in use.
:)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.