Odd bug. My unfortunate workaround is to use CIDetectorAccuracyLow, in the case that we're on an iOS simulator:
#if targetEnvironment(simulator)
let detectorAccuracy = CIDetectorAccuracyLow
#else
let detectorAccuracy = CIDetectorAccuracyHigh
#endif
let options = [CIDetectorAccuracy: detectorAccuracy]
let faceDetector = CIDetector(ofType: CIDetectorTypeFace, context: nil, options: options)
I don't love the solution, as it seems like the type of hack that will remain, forgotten, in the codebase, quietly confusing future developers, for the rest of eternity. But, low accuracy works on Simulator and I suppose it doesn't matter too much so long as production users still get the high accuracy detection.
Topic:
Programming Languages
SubTopic:
Swift
Tags: