Skip to content

v2.0.2 ios setScanRegion crashes the app. #2

Description

@TheRealPingWin

I managed to debug the problem and the directions from region are doubles instead of int.
Foundation/NSNumber.swift:384: Fatal error: Unable to bridge NSNumber to Int

 let region = call.getObject("region")
 self.scanRegion = ScanRegion()
 self.scanRegion.top = region?["top"] as! Int

I temporarily fix it like this:

 if let region = call.getObject("region") as? [String: Any] {
          self.scanRegion = ScanRegion()
          self.scanRegion.top = Int(region["top"] as? Double ?? 0.0)
          self.scanRegion.right = Int(region["right"] as? Double ?? 0.0)
          self.scanRegion.left = Int(region["left"] as? Double ?? 0.0)
          self.scanRegion.bottom = Int(region["bottom"] as? Double ?? 0.0)
          self.scanRegion.measuredByPercentage = Int(region["measuredByPercentage"] as? Double ?? 0.0)
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions