2015-03-19 1 views
0

Следующий код дает мне ошибку Extra argument 'userinfo' in call. Я посмотрел на предложения от @27620493 и 27875005Дополнительный аргумент 'userinfo' в вызове CLLocation

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])) 


} 

Я не знаю, почему я получаю эту ошибку с учетом currentLocation не является обязательным.

ответ

1

Изменить код, который:

dispatch_async(dispatch_get_main_queue(), {() -> Void in 
    NSNotificationCenter.defaultCenter().postNotificationName(SOCurrentLocationDidChangeNotification, object: nil, userInfo: ["kSOLocationKey" : currentLocation]) 
})