标签: didfailwitherror

如何处理位置管理器的"不允许"?

我现在还没有想到这一点.

直到现在每当设备要求我使用位置更新时我都允许它.

但是现在我不允许它,位置管理器给我kclErrorDenied并且位置管理器在重新启动应用程序之前无法再次启动.

所以我的问题是,我应该给用户重新启动应用程序的消息,还是有解决方案再次开始使用位置管理器.

谢谢 .

The Error :
ERROR,Time,288787555.078,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 1
WARNING,Time,288787555.108,Function,"void CLClientHandleDaemonInvalidation(__CFMessagePort*, void*)",client 1308.0 has been disconnected from daemon
 locationManager:didFailWithError:] [Line 244] Error Denied :Error Domain=kCLErrorDomain Code=1 "Operation could not be completed. (kCLErrorDomain error 1.)"
Run Code Online (Sandbox Code Playgroud)

iphone cllocationmanager didfailwitherror

17
推荐指数
1
解决办法
1万
查看次数

Swift:在didFailWithError中处理NSError的Corelocation

我正在使用CoreLocation来成功确定用户的位置.但是,当我尝试使用CLLocationManagerDelegate方法时:

func locationManager(_ manager: CLLocationManager!, didFailWithError error: NSError!)
Run Code Online (Sandbox Code Playgroud)

我遇到了错误术语的问题.

func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) {
    println("didFailWithError \(error)")

    if let err = error {
        if err.code == kCLErrorLocationUnknown {
            return
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这会导致"使用未解析的标识符kCLErrorLocationUnknown"错误消息.我知道kCLErrors是枚举,并且它们已经在Swift中进化但我被卡住了.

nserror didfailwitherror swift ios8

15
推荐指数
2
解决办法
5515
查看次数

locationManager didFailWithError

从1周起,如果我的gps应用程序无法检索信号(例如:在我家测试)我没有收到任何aler.我以这种方式设置了错误通知

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {      NSString *errorType = (error.code == kCLErrorDenied) ? 
@"Access Denied" : @"Errore sconosciuto"; 
UIAlertView *alert = [[UIAlertView alloc] 
                      initWithTitle:@"Errore recuperando la Location" 
                      message:errorType 
                      delegate:nil 
                      cancelButtonTitle:@"Okay" 
                      otherButtonTitles:nil]; 
[alert show]; 
[alert release]; 
} 
Run Code Online (Sandbox Code Playgroud)

为什么应用程序不检索数据,并没有显示警报弹出窗口?

iphone uialertview iphone-sdk-3.0 cllocationmanager didfailwitherror

12
推荐指数
1
解决办法
2万
查看次数

委托必须响应locationManager:didFailWithError:即使实现了didFailWithError方法

出于某种原因,Xcode认为我没有实现协议的didFailWithError方法CLLocationManagerDelegate

在此输入图像描述 在此输入图像描述

我没有看到我做错了什么,因为我从另一个SO帖子中复制了一下,说这个didFailWithError方法是为Swift 3更新的.所以我不明白为什么Xcode认为我没有实现didFailWithError

任何见解将不胜感激!

class OptionsViewController: UIViewController,
    CLLocationManagerDelegate {
var locationManager: CLLocationManager = CLLocationManager()

    override func viewDidLoad() {
//Ask user for location
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest

        //Use users current location if no starting point set
        if CLLocationManager.locationServicesEnabled() {
            if CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedWhenInUse
                || CLLocationManager.authorizationStatus() == CLAuthorizationStatus.authorizedAlways {
                locationManager.requestLocation()
            }
            else{
                locationManager.requestWhenInUseAuthorization()
            }
        }
        else{
            //Alert user to open location service, bra bra bra here...
        }
    }

func locationManager(_ manager: …
Run Code Online (Sandbox Code Playgroud)

xcode cllocationmanager didfailwitherror ios swift3

3
推荐指数
1
解决办法
1746
查看次数