React to location authorization changed in Settings
WHAT IT TESTS: Observing authorization changes via the delegate. OUTLINE: Implement locationManagerDidChangeAuthorization, which fires on launch and whenever status changes, read authorizationStatus, and start updates when authorized.
WHAT IT TESTS: Whether you know the authorization-change callback and app lifecycle reality. ANSWER OUTLINE: Implement the CLLocationManagerDelegate method locationManagerDidChangeAuthorization(_:), which the system calls when you create the manager and again whenever authorization changes. When the app resumes after the user grants access in Settings, this delegate fires; you check manager.authorizationStatus and, if authorizedWhenInUse or authorizedAlways, call startUpdatingLocation or requestLocation.
Read the original → interview
- #ios
- #core-location
- #permissions
- #delegate
- #lifecycle
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.