Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 检查用户是否允许应用程序使用其位置_Iphone_Location_Mkmapview_Cllocationmanager - Fatal编程技术网

Iphone 检查用户是否允许应用程序使用其位置

Iphone 检查用户是否允许应用程序使用其位置,iphone,location,mkmapview,cllocationmanager,Iphone,Location,Mkmapview,Cllocationmanager,当应用程序首次尝试获取用户位置时,系统会提示用户“想使用当前位置”,用户可以点击“不允许”或“确定”。有没有办法确定用户是否点击了“确定”或“不允许”?我试图让MKMapView显示用户的当前位置,但我希望根据用户选择采取不同的操作 通常你会认为会有一个代表来获取这些信息,但似乎没有 提前感谢您的帮助。您获取用户位置的第一次呼叫将失败,并出现一个错误,告诉您用户拒绝了位置服务。您的CLLocationManagerDelegate方法didFailWithError将被调用,如下所示。(常数在c

当应用程序首次尝试获取用户位置时,系统会提示用户“想使用当前位置”,用户可以点击“不允许”或“确定”。有没有办法确定用户是否点击了“确定”或“不允许”?我试图让MKMapView显示用户的当前位置,但我希望根据用户选择采取不同的操作

通常你会认为会有一个代表来获取这些信息,但似乎没有


提前感谢您的帮助。

您获取用户位置的第一次呼叫将失败,并出现一个错误,告诉您用户拒绝了位置服务。您的
CLLocationManagerDelegate
方法
didFailWithError
将被调用,如下所示。(常数在
cleror.h
中定义)


startMonitoringSignificantLocationChanges的情况似乎并非如此
- (void)locationManager:(CLLocationManager*)aManager didFailWithError:(NSError*)anError
{
    switch([anError code])
    {
    case kCLErrorLocationUnknown: // location is currently unknown, but CL will keep trying
    break;

    case kCLErrorDenied: // CL access has been denied (eg, user declined location use)
    message = @"Sorry, flook has to know your location in order to work. You'll be able to see some cards but not find them nearby";
    break;

    case kCLErrorNetwork: // general, network-related error
    message = @"Flook can't find you - please check your network connection or that you are not in airplane mode";
    }
}