PDA

View Full Version : How to handle "Don't Allow" case?




arnieterm
Feb 17, 2009, 09:11 AM
Hi
While using the CoreLocation in an iphone application. The user is displayed the alert that "appname" would like to use your current location with options "Don't Allow" and "Ok".
if user selects "Don't Allow" how can we handle this situation as locationserviceenabled property returns true.

Thanks
Arnieterm



arnieterm
Feb 18, 2009, 07:12 AM
It seems to me that I have to handle "didFailWithError" event of CLLocationManager as it returns kCLErrorDomain with error code 0. I think the below given code will handle this:

NSString* strError;
if([error domain]==kCLErrorDomain)
{
switch([error code])
{
case kCLErrorDenied:
strError=@"Location denied error";
//Should correspond to "Don't Allow"
break;
case kCLErrorLocationUnknown:
strError=@"Unknown location error";
break;
default:
strError=@"Generic Location Error";
break;
}
}