8

I am using the MKReverseGeocoder but I keep getting reverseGeocoder:didFailWithError: "The operation couldn’t be completed. (MKErrorDomain error 4.)". I am passing the geocoder the coordinates of the MKUserLocation annotation. What does this error mean & how can I avoid it?

Kyle Decot
  • 20,715
  • 39
  • 142
  • 263
  • possible duplicate of [MKErrorDomain error 4 iPhone](http://stackoverflow.com/questions/3926164/mkerrordomain-error-4-iphone) – Matt Apr 06 '14 at 10:11

3 Answers3

4

My answer to a similar question:

I've met and solved this issue recently. In my case, when Apple Map cannot find any result for a query, it sometimes will just throw this this "MKErrorDomain = 4" error. So I ended up just treating this as "result not found".

It was painstaking to find this out, MapKit needs a better Error handling system.

Community
  • 1
  • 1
Ascendant
  • 2,430
  • 3
  • 26
  • 34
0

It's documented at https://developer.apple.com/documentation/mapkit/mkerror/code#topics.

If you look into the code of MKError, you find the enum:

public enum Code : UInt {

        
        public typealias _ErrorType = MKError

        case unknown = 1

        case serverFailure = 2

        case loadingThrottled = 3

        case placemarkNotFound = 4

        @available(iOS 7.0, *)
        case directionsNotFound = 5

        @available(iOS 13.0, *)
        case decodingFailed = 6
    }

So MKERRORDOMAIN error 4 just means "placemark not found".

Jannik Arndt
  • 447
  • 5
  • 13
0

Actually this error of DEBUG:- ERROR The operation couldn’t be completed. (MKErrorDomain error 4.) I was solved when clear all recentApp's from simulator and re-run it.