type of expression is ambiguous without more context for NSNotification

1.2k Views Asked by At

I have migrated my code from XCode 8.0 to XCode 9.4

Now I am getting this error:

type of expression is ambiguous without more context

private let visageNoFaceDetectedNotification = NSNotification(name: "visageNoFaceDetectedNotification", object: nil)

Everything was working fine in XCode 8.0.

I think because of swift version changed, it is happening.

1

There are 1 best solutions below

1
rmaddy On BEST ANSWER

Swift 4 changed how you create notification names.

Change your code to:

private let visageNoFaceDetectedNotification = NSNotification(name: NSNotification.Name(rawValue: "visageNoFaceDetectedNotification"), object: nil)