5

I am using Google Mobile Vision in my app. I am getting a unrecognized selector lldb crash. I have narrowed down the problem to this line of code...

   var faceDetector = GMVDetector.init(ofType: GMVDetectorTypeFace, options: options)

Here is the variable options:

let options = [GMVDetectorFaceLandmarkType: GMVDetectorFaceLandmark.all, GMVDetectorFaceClassificationType: GMVDetectorFaceClassification.all, GMVDetectorFaceTrackingEnabled: false] as [String : Any]

Is there something wrong with options? I have looked at other SO posts and found that most problems originate from a dictionary.

How would I fix this problem?

coder
  • 381
  • 2
  • 22

1 Answers1

10

Use raw value of the enums, GMVDetectorFaceLandmark.all.rawValue etc.

eg:

var faceDetector = GMVDetector(ofType: GMVDetectorTypeFace, options: [GMVDetectorFaceLandmarkType: GMVDetectorFaceLandmark.all.rawValue,
                                                                               GMVDetectorFaceClassificationType: GMVDetectorFaceClassification.all.rawValue,
                                                                               GMVDetectorFaceMinSize: 0.3,
                                                                               GMVDetectorFaceTrackingEnabled: true])
Rukshan
  • 7,902
  • 6
  • 43
  • 61