Code Monkey home page Code Monkey logo

Comments (6)

jhoogstraat avatar jhoogstraat commented on September 4, 2024

Do you know more parameters to the crash? Like which devices are affected or which version of iOS?

Demangled symbol:

function signature specialization of fast_barcode_scanner.BarcodeReader.metadataOutput(_: __C.AVCaptureMetadataOutput, didOutput: Swift.Array<__C.AVMetadataObject>, from: __C.AVCaptureConnection) -> ()

Which is

func metadataOutput(_ output: AVCaptureMetadataOutput,
                        didOutput metadataObjects: [AVMetadataObject],
                        from connection: AVCaptureConnection) {
		guard
			let metadata = metadataObjects.first,
			let readableCode = metadata as? AVMetadataMachineReadableCodeObject
			else { return }

		pauseIfRequired()

		codeCallback([flutterMetadataObjectTypes[readableCode.type]!, readableCode.stringValue!])
	}

The only possible cause could be the force unwrappings here: [flutterMetadataObjectTypes[readableCode.type]!, readableCode.stringValue!].

The first one is really unlikely to have caused the crash, because AVFoundation supports a fixed range of code types which I just copied into flutterMetadataObjectTypes.

Are there code types that do not have a value?

Anyway I guess it would be good to have both unwrappings in the guard statement as it is in #17.

from fast_barcode_scanner.

seth35us avatar seth35us commented on September 4, 2024

I do not know what code types do not have a value. I think you are correct. I have modified the code in my project below and will see if the crash goes away. Do you want me to do a PR, or do you want to make the change?

Thank you for looking into this error.

func metadataOutput(_ output: AVCaptureMetadataOutput,
                        didOutput metadataObjects: [AVMetadataObject],
                        from connection: AVCaptureConnection) {
		guard
			let metadata = metadataObjects.first,
			let readableCode = metadata as? AVMetadataMachineReadableCodeObject,

			let type = flutterMetadataObjectTypes[readableCode.type],
        	        let value = readableCode.stringValue
			
			else { return }

	

		pauseIfRequired()

		codeCallback([type, value])
	}

from fast_barcode_scanner.

jhoogstraat avatar jhoogstraat commented on September 4, 2024

Did we fix this issue in the develop branch?
Not sure where we left of.

from fast_barcode_scanner.

seth35us avatar seth35us commented on September 4, 2024

I did not edit development. I ended up trying this package instead: https://pub.dev/packages/fl_mlkit_scanning. It seems really good, but possibly cpu intensive. I may try your cpu tests to see how it compares to AVFoundation.

from fast_barcode_scanner.

jhoogstraat avatar jhoogstraat commented on September 4, 2024

Too bad. The force unwrapping is gone on develop branch, so the bug should not happen on there, if you like to try again!

from fast_barcode_scanner.

seth35us avatar seth35us commented on September 4, 2024

Thanks, I will try again. I appreciate you fixing the issues!

from fast_barcode_scanner.

Related Issues (20)

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.