0

I get the error missing argument for parameter #1 in call when trying to call geocodeLocation in the viewDidLoad, this is kind of a random error or im doing something completely wrong?

override func viewDidLoad(){
    super.viewDidLoad()
    locationManager.delegate = self
    locationManager.requestAlwaysAuthorization()
    locationManager.startUpdatingLocation()
    geocodeLocation() //Missing argument for parameter #1 in call 
}

func geocodeLocation(location: String){
    let geocode = CLGeocoder()
    geocode.geocodeAddressString(location) {  (objects, error) -> Void in
        if error != nil {
            print(error)
        } else {
            self.createActionSheet(objects!)
            self.locationArray = objects
        }
    }
}

I don't understand what I have to add next, suggestions? I am trying to display a location on the map with a pin with the location coming from the class.

Breek
  • 1,431
  • 13
  • 24
ABlach
  • 17
  • 5

1 Answers1

1

You are getting complain because your geocodeLocation(location: String) function requires a parameter with type String.

You need to pass in some string like:

geocodeLocation("123 Main st")

Breek
  • 1,431
  • 13
  • 24