<分区>
Possible Duplicate:
Determining if user has denied CoreLocation permission
如果用户拒绝在 iOS 应用中“使用我的默认位置”,我将如何检测?
我想根据他们的选择向他们展示不同的 View Controller 。
谢谢
<分区>
Possible Duplicate:
Determining if user has denied CoreLocation permission
如果用户拒绝在 iOS 应用中“使用我的默认位置”,我将如何检测?
我想根据他们的选择向他们展示不同的 View Controller 。
谢谢
最佳答案
为此,您需要实现以下委托(delegate)方法:
- (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error
{
if([error code]== kCLErrorDenied)
self.locationDenied = YES;
switch ([error code]) {
// "Don't Allow" on two successive app launches is the same as saying "never allow". The user
// can reset this for all apps by going to Settings > General > Reset > Reset Location Warnings.
case kCLErrorDenied:
[appDelegate showAllowGPSLocationView];
default:
break;
}
self.locationDefined = NO;
}
您可以在 AppDelegate 中创建方法“showAllowGPSLocationView”。并向用户显示您需要访问 GPS 位置。
希望它能解决您的问题。
编码愉快!
关于iphone - 如何检测用户是否拒绝使用我的默认位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14580292/