0

The following code gives me an Extra argument 'userinfo' in call error. I've looked at the suggestions from @27620493 and 27875005

class SOViewController : UIViewController {

var currentLocation : CLLocation!

func setCurrentLocation(currentLocation: CLLocation) {

    if (self.currentLocation == currentLocation) {
        return
    }
    self.currentLocation = currentLocation

    dispatch_async(dispatch_get_main_queue(), NSNotificationCenter.defaultCenter().postNotificationName(aName: SOCurrentLocationDidChangeNotification, object: nil, userInfo: ["kSOLocationKey" : currentLocation]))


}

I'm not sure why I'm getting this error considering currentLocation is optional.

Community
  • 1
  • 1
tfrancis
  • 43
  • 5

1 Answers1

1

Modify code for that:

dispatch_async(dispatch_get_main_queue(), { () -> Void in
    NSNotificationCenter.defaultCenter().postNotificationName(SOCurrentLocationDidChangeNotification, object: nil, userInfo: ["kSOLocationKey" : currentLocation])
})
Azat
  • 6,745
  • 5
  • 31
  • 48