The first time the app tries to get the users location they are prompted with "Would like to use your current location" and they can hit Don't allow or ok. Is there any way to find out if the user has hit ok or don't allow? I'm trying to have the MKMapView show the users current location but I would like to take different actions based on the users selection.
Normally you would think there would be a delegate to get this information but there doesn't seem to be.
Thanks in advance for your help.
Your first call to get the user's location will fail with an error which tells you the user has denied location services. Your CLLocationManagerDelegate
method didFailWithError
will be called, as below. (The constants are defined in CLError.h
)
- (void)locationManager:(CLLocationManager*)aManager didFailWithError:(NSError*)anError
{
switch([anError code])
{
case kCLErrorLocationUnknown: // location is currently unknown, but CL will keep trying
break;
case kCLErrorDenied: // CL access has been denied (eg, user declined location use)
message = @"Sorry, flook has to know your location in order to work. You'll be able to see some cards but not find them nearby";
break;
case kCLErrorNetwork: // general, network-related error
message = @"Flook can't find you - please check your network connection or that you are not in airplane mode";
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With