QRCodeReader.swift
QRCodeReader.swift copied to clipboard
Exception: Array mutated while being enumerated
An issue came up in our app's Crashlytics that unfortunately I haven't been able to reproduce. No info on context, other than it's on an iPhone X running iOS 12.4.1.

Any thoughts would be great.
Very interesting.
The only place where the metadataObjectTypes
are mutating is during the initialisation. Maybe a race condition during the init workflow?
Needs more investigation.
I also got this crash reported today (see attachment). I've been trying to reproduce it with no luck.
One thing I noticed on the QRCodeReader init (and raised some suspicion regarding the race condition that you mentioned) is the use of a queue to perform the session configuration asynchronously. Is there a particular reason for dispatching in a queue instead of doing "directly"?
sessionQueue.async {
self.configureDefaultComponents(withCaptureDevicePosition: captureDevicePosition)
}

Getting the same crash on crashlytics in QRCodeReader.init
sessionQueue.async {
self.configureDefaultComponents(withCaptureDevicePosition: captureDevicePosition)
}
Im unable to reproduce it @lm2s @yannickl Any news regarding that one ?