Yurie
Yurie

Reputation: 899

Linker cannot find MKErrorDomain

After adding a test for error code to MKReverseGeocoder's callback, got a linker error indicating that _MKErrorDomain is not defined:

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error {
    // some useful but irrelevant code removed here...

    // if the error is not permanent, try again
    NSString *errorDomain = [error domain];
    NSInteger errorCode = [error code];

    if ([errorDomain isEqualToString:MKErrorDomain] && errorCode != MKErrorPlacemarkNotFound) {
        [self scheduleReverseLookup];
    }
}

Linker error:

Undefined symbols for architecture armv6:
  "_MKErrorDomain", referenced from:
      -[Tracker reverseGeocoder:didFailWithError:] in Tracker.o

Note that MapKit is being linked in and works fine with the test for MKErrorDomain removed.

Upvotes: 0

Views: 259

Answers (1)

Vincent Guerci
Vincent Guerci

Reputation: 14419

I have the same issue, which is also true for arvm7, with latest iOS 4.3 / Xcode 4.0.1.

Looks like <MapKit/MKTypes.h> is missing his little brother MKTypes.o in MapKit binary...

Anyway, a quick (and dirty) fix is to use @"MKErrorDomain" instead of the MKErrorDomain constant.

Or a little bit better, in any case this is fixed later, or if you reference it a lot, you can redefine it :

#define MKErrorDomain @"MKErrorDomain"

Upvotes: 2

Related Questions