zxingify-objc: dismissviewcontroller:aimated:completion: in captureresult:result: crashes app

i started integrating zxingobjc into my app by using the example code and it works well, but I want to dismiss the Scanner view controller when I actually get a result while scanning, so I stop the capture and call dismissviewcontroller:animated:completion, but right after the controller is dismissed, the app crashes.

i get some messages from libobjc.A.dylib`objc_msgSend: which i don’t understand, but I guess it might be a threading error. not sure though.

i also tried making sure to dismiss from the main thread, but it didn’t help. is this a known issue and do you have any tips for me as how to dismiss the scanner view controller correctly when it got a result?

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

I found that you need to remove the capture.layer from your view before calling dismissViewControllerAnimated:completion:. Here’s what I do when dismissing the view controller:


[self.capture.layer removeFromSuperlayer];
[self.capture stop];
[self dismissViewControllerAnimated:YES completion:nil];