Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parameters of 'locationManager(_:didUpdateLocations:)' has different optionality than expected by protocol 'CLLocationManagerDelegate'

I have implemented CLLocationManagerDelegate in my viewcontroller and I am getting the following warnings

Parameters of 'locationManager(_:didUpdateLocations:)' have different optionality than expected by protocol 'CLLocationManagerDelegate'

Parameters of 'locationManager(_:didFailWithError:)' have different optionality than expected by protocol 'CLLocationManagerDelegate'

Parameter of 'locationManager(_:didChangeAuthorizationStatus:)' has different optionality than expected by protocol 'CLLocationManagerDelegate'

From this what I understood " Optionality of parameters(whether the variable is optional or not) is different from what is there in original protocol method definition "

But I couldn't find any difference between the original and what I have with me.

Here it is

In Protocol definition

optional public func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])

optional public func locationManager(manager: CLLocationManager, didFailWithError error: NSError)

optional public func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus)

In my implementation of the protocol

func locationManager(manager: CLLocationManager,
        didUpdateLocations locations: [CLLocation])

func locationManager(manager: CLLocationManager,
        didFailWithError error: NSError)

func locationManager(manager: CLLocationManager,
        didChangeAuthorizationStatus status: CLAuthorizationStatus)

My xcode version is 7.1.1

So can anybody explain me why the warnings are popping up ?

like image 325
Durai Amuthan.H Avatar asked Jan 26 '26 00:01

Durai Amuthan.H


1 Answers

Restarting the xcode solved the problem...sometimes things are strange

like image 149
Durai Amuthan.H Avatar answered Jan 28 '26 17:01

Durai Amuthan.H



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!