【发布时间】:2014-10-25 09:52:45
【问题描述】:
使用CLLocationManager它显示弹出消息
是否允许“AppName”在您不使用该应用时访问您的位置?
有两个选项不允许和允许点击允许它触发didUpdateLocations点击不允许什么是它调用的委托方法?
【问题讨论】:
标签: ios objective-c delegates cllocationmanager
使用CLLocationManager它显示弹出消息
是否允许“AppName”在您不使用该应用时访问您的位置?
有两个选项不允许和允许点击允许它触发didUpdateLocations点击不允许什么是它调用的委托方法?
【问题讨论】:
标签: ios objective-c delegates cllocationmanager
如果用户拒绝了didFailWithError调用的权限并且错误类型也
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
// [manager stopUpdatingLocation];
NSLog(@"error%@",error);
switch([error code])
{
case kCLErrorNetwork: // general, network-related error
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Error!" message:@"Can't access your current location! Please check your network connection or that you are not in airplane mode!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
}
break;
case kCLErrorDenied:{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Error!" message:@"Location Access has been denied for app name!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
// alert.tag=500;
[alert show];
}
break;
default:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Error!" message:@"Can't access your current location!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
}
break;
}
}
【讨论】: