Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access the user's location on Today Extension

Is it possible to access the user's location on a widget?

I used the new iOS 8 API

[locationManager requestWhenInUseAuthorization];

and I added to the info.plist file the key

NSLocationWhenInUseDescription

however, when I request the location access, an alert should appear, but it doesn't happen.

Are there some not declared limitations on iOS today extensions?

like image 632
Massimo Piazza Avatar asked Jun 15 '14 14:06

Massimo Piazza


2 Answers

As I found out, didUpdateLocations: delegate method doesn't work in today extension. So, to get location use locationManager.location.

like image 149
Shmidt Avatar answered Oct 07 '22 17:10

Shmidt


Along with requesting authorization, you must also explicitly ask your location manager to start updating locations.

[locationManager requestWhenInUseAuthorization];
[locationManager startUpdatingLocation];
like image 40
djibouti33 Avatar answered Oct 07 '22 15:10

djibouti33