I am developing an iOS application based on map and location tracking. When the user first downloads the application, he requests permission to track location, etc. Just great. The only problem is that when I do this, I have code setting up the initial map view and other location-based variables before the user clicks OK.
I found that I can put these initialization steps after the while loop, which waits for the user to change the permissions of the location manager, as shown below, but this may not be best practice, not to mention that this leads to some strange behavior in transition between splash screen and map:
BOOL firstrun = TRUE; while ([[locationManager class] authorizationStatus] == kCLAuthorizationStatusDenied || [[locationManager class] authorizationStatus] == kCLAuthorizationStatusNotDetermined) { NSLog(@"Waiting for location permission"); } ...initiation code...
Is there a listener available to access the location for the warning window or similar feature in the location manager delegate that I don't know about? I do not see such a method in the docs. Does anyone know what is best practice? Thank you very much.
EDIT I start location tracking as follows:
if (nil == locationManager) locationManager = [[CLLocationManager alloc] init]; [locationManager startMonitoringSignificantLocationChanges]; self.musicmap.delegate = self; [self.mymap setShowsUserLocation:true];
thanks
Primus202
source share