![](/img/trans.png)
[英]How to determine if app shows the “App X would like to use your current location” alert?
[英]which is the delegate method for don't allow tap in “App would like to use your current location”?
當用戶在彈出窗口“應用程序要使用您的當前位置”中按下“不允許”時,我想打開一個彈出窗口。 是否有任何委托方法?
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
if (status == kCLAuthorizationStatusDenied) {
// FA1LZ
}
}
檢查CLLocationManagerDelegate
locationManager:didFailWithError:
和locationManager:didChangeAuthorizationStatus:
locationManager:didFailWithError:
您可以使用以下委托方法:
- (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;
}
當用戶不允許GPS定位時,將調用上述委托方法。 您可以使用“ kCLErrorDenied”進行檢查並處理您想做的任何事情。
在此,“ showAllowGPSLocationView”是在“ AppDelegate”中實現的方法,用於通知用戶允許GPS定位。
希望對您有幫助。
快樂編碼:)
干杯!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.