链接器找不到MKErrorDomain [英] Linker cannot find MKErrorDomain

查看:82
本文介绍了链接器找不到MKErrorDomain的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MKReverseGeocoder的回调中添加了针对错误代码的测试后,出现了链接器错误,指示未定义_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];
    }
}

链接器错误:

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

请注意,已将MapKit链接到其中,并且在删除MKErrorDomain的测试中可以正常工作.

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

推荐答案

在最新的iOS 4.3/Xcode 4.0.1中,我遇到了同样的问题,对于arvm7也是如此.

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

好像<MapKit/MKTypes.h>在MapKit二进制文件中缺少了他的弟弟MKTypes.o ...

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

无论如何,一种快速(且肮脏的)解决方法是使用@"MKErrorDomain"而不是MKErrorDomain常量.

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"

这篇关于链接器找不到MKErrorDomain的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆