Closed msylvester closed 8 years ago
Having multiple extensions on your view controller should be fine! Whenever delegate methods aren't being called, the first thing to check is that you've set your delegate properly. Somewhere in your code, you should have:
let locationManager = CLLocationManager()
locationManager.delegate = self
Let me know if that helps!
Yes, I have the variable declaration (i.e.the let statement) under the class definition and I set the delegate in viewDidLoad prior to determining the authorization status. For the cases, AuthorizedAlways and AuthorizedWhenInUse, I set the properties of location manager and call locationManager.startUpdatingLocation().
Still, tho, no dice
Look at the Info.plist, make sure that you have the added the additional keys for location services.
@tabinks. In info.plist:
Required Device Capabilities
This matches your slide except that instead of UIRequiredDeviceCapabalities my plist has Required Device Capabilities. Note, if I try to change it to UIRequiredDeviceCapabalites it says it already exists as Required Device Capabilities.
It doesn't work. Any ideas?
@msylvester Are you setting the NSLocationWhenInUseUsageDescription
and NSLocationAlwaysUsageDescription
in the Info.plist?
Yes, they are set.
I am having problems with Location Manager, I have implemented the code as described in the lecture "Location, Location, Location".
My program requests authorization and enters the appropriate code block (i.e. alwaysauthorized). However, the functions in the extension to the root view controller class which contains the CLLocation Delegate are never called (i.e. those functions func locationManager(etc., etc)).
I have two extension (including this one) for my root view controller class, I don't know if that is a problem.
Help! Singleton, maybe?