Linker cannot find MKErrorDomain

别等时光非礼了梦想. 提交于 2019-12-12 04:15:26

问题


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.


回答1:


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"


来源:https://stackoverflow.com/questions/5494383/linker-cannot-find-mkerrordomain

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!