位置权限错误(在info.plist中授予访问权限)

时间:2017-02-16 13:49:39

标签: xamarin xamarin.ios

我有一个使用Xamarin编码的iOS应用程序。 但是,每次我到达需要访问位置的屏幕 我收到一条说明

的错误消息
  

无法完成操作。 (kCLErrorDomain错误0)

在info.plist中,我已经为应用程序提供了以下权限

  

位置始终使用说明 =“想要访问您的位置”

     

位置在使用说明中 =“想要访问您的位置”

此错误仅显示在一台iPad上,但另一台iPad似乎没有遇到此错误 在iPad设置中,访问被授予应用程序,这是我为确保在应用程序中授予访问权限而进行的检查之一

1 个答案:

答案 0 :(得分:1)

  

kCLErrorDomain 错误0

该错误代码等于:

  

kCLErrorLocationUnknown = 0,//位置当前未知,但CL会继续尝试

由于无法访问设备上的GPS,Wifi和/或Cell网络,因此通常对CoreLocation管理器失败。失败的iPad是否具有Cellular,是否正常工作,有效的SIM卡是Wifi吗?连接到有效/可用的SSID等......

CLError.h:

typedef NS_ENUM(NSInteger, CLError) {
    kCLErrorLocationUnknown  = 0,         // location is currently unknown, but CL will keep trying
    kCLErrorDenied,                       // Access to location or ranging has been denied by the user
    kCLErrorNetwork,                      // general, network-related error
    kCLErrorHeadingFailure,               // heading could not be determined
    kCLErrorRegionMonitoringDenied,       // Location region monitoring has been denied by the user
    kCLErrorRegionMonitoringFailure,      // A registered region cannot be monitored
    kCLErrorRegionMonitoringSetupDelayed, // CL could not immediately initialize region monitoring
    kCLErrorRegionMonitoringResponseDelayed, // While events for this fence will be delivered, delivery will not occur immediately
    kCLErrorGeocodeFoundNoResult,         // A geocode request yielded no result
    kCLErrorGeocodeFoundPartialResult,    // A geocode request yielded a partial result
    kCLErrorGeocodeCanceled,              // A geocode request was cancelled
    kCLErrorDeferredFailed,               // Deferred mode failed
    kCLErrorDeferredNotUpdatingLocation,  // Deferred mode failed because location updates disabled or paused
    kCLErrorDeferredAccuracyTooLow,       // Deferred mode not supported for the requested accuracy
    kCLErrorDeferredDistanceFiltered,     // Deferred mode does not support distance filters
    kCLErrorDeferredCanceled,             // Deferred mode request canceled a previous request
    kCLErrorRangingUnavailable,           // Ranging cannot be performed
    kCLErrorRangingFailure,               // General ranging failure
};