'WhereamiAppDelegate' does not implement the 'CLLocationMana


#1

I’ve entered the Chapter 4 code and it runs, correctly showing the location in the console. However, I cannot get rid of this compiler warning:

‘WhereamiAppDelegate’ does not implement the ‘CLLocationManagerDelegate’ protocol

I’ve even resorted to copying/pasting the exact signatures from the Apple docs. No joy. What am I missing?


#2

@interface WhereamiAppDelegate : NSObject <UIApplicationDelegate, CLLocationManagerDelegate>

easy one to miss


#3

That did it. Thanks!

I’m still getting used to XCode but the “Build Succeeded - No Issues” alongside the warning really confused me. Am I right in assuming the code was working despite the warning?


#4

It was working correctly, yes.

Because of the dynamic messaging system that Objective-C uses, sometimes the compiler can’t tell you “for sure” if something is an error. Thus, it gives you a warning. Some of these warnings (like “may not respond to selector”) will most likely be errors. Others, like “does not implement protocol”, probably won’t cause a problem.

However, having warnings in your code is bad, and you should strive to eliminate them.