Post

Replies

Boosts

Views

Activity

Reply to Request locations using CLLocationManager in Widget target on iOS 14
Hello everyone! Has anyone managed to get it working? I have two entries in Widget's info.plist as @markdaws mentioned. My location manager wrapper looks this way: class WidgetLocationManager: NSObject, CLLocationManagerDelegate {     var locationManager: CLLocationManager? {         didSet {             self.locationManager!.delegate = self         }     }     private var handler: ((CLLocation) -> Void)?     func fetchLocation(handler: @escaping (CLLocation) -> Void) {         self.handler = handler &#9;&#9;&#9;&#9;self.locationManager!.requestLocation()     }     func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {         self.handler!(locations.last!)     }     func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {         print(error)     } } And getTimeline function this way: &#9;&#9;var widgetLocationManager = WidgetLocationManager()     func getTimeline(for configuration: SelectPlaceIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> Void) {         if widgetLocationManager.locationManager == nil {             widgetLocationManager.locationManager = CLLocationManager()             widgetLocationManager.locationManager!.requestWhenInUseAuthorization()         }         widgetLocationManager.fetchLocation(handler: { location in             print(location)             ........         })     } When locationManager.requestLocation() is being called, authorisation status is authorisedWhenInUse, but delegate's method is never being called. What am I missing?
Sep ’20