SwiftLocation icon indicating copy to clipboard operation
SwiftLocation copied to clipboard

Error Processing

Open perryhoekstra opened this issue 5 years ago • 3 comments

In the case of:

SwiftLocation.gpsLocation(accuracy: .neighborhood).then { result in switch result { case .success(let locationData): do some successfull processing
case .failure( _): do some failure processing } }

How do you handle error processing where the result callback is not returned (such as the user stating Don't Allow)? I did not see that identified in the documentation.

perryhoekstra avatar Jan 13 '21 12:01 perryhoekstra

SwiftLocation.gpsLocation(accuracy: .neighborhood).then { result in
    switch result {
    case .success(let locationData):
        print(locationData)
    case .failure(let error):
        switch error {
        case .authorizationNeeded:
            //do some failure processing
            break
        default:
            break
        }
    }
}

hamzaozturk avatar Jan 23 '21 01:01 hamzaozturk

No, if the user selects Don't Allow, it will not fail into .failure case.

perryhoekstra avatar Jan 23 '21 02:01 perryhoekstra

Same here! iOS 15 real device iPhone 12 Pro. Quite important feature.

appfrilans avatar Jan 11 '22 16:01 appfrilans