Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
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

macrumors regular
Original poster
Aug 28, 2008
201
0
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:
Code:
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;
		}
	}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.