我正在运行一个需要启用 LocationServices 的应用程序。我正在通过调用服务并捕获错误来检查它们是否存在。在错误情况下,我想弹出一个警报视图,通知用户激活位置服务。进行此测试时,我已经打开了另一个 AlertView。我想关闭那个并给用户我之前提到的对话框。
目前,我有
case kCLErrorDenied: // CL access has been denied (eg, user declined location use)
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"NOTICE"
message:@"Sorry, this application needs your location. Please select 'Allow' when asked to use your current location. You don't need to be on or near the trail."
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"EXIT"];
[alert show];
[alert release];
//exit(0);
break;
这会导致应用程序退出。我在那里有一个 NSLog 输出,所以我知道它涉及到这种情况。