我正在研究比Xcode提供的更高級的CLLocationManager
模擬,並且遇到了一個奇怪的問題。我有子類都CLLocationManager
和CLLocation
:OSL上的CLLocation子類化
// foobar.h
@interface MyLocation : CLLocation
@end
@interface MyLocationManager : CLLocationManager
@end
// foobar.m
@implementation MyLocation
@end
@implementation MyLocationManager
@end
現在,如果我建立適用於iOS的一切項目是好的,但是當我的OS X做的一樣,我在聯得到這個錯誤:
Undefined symbols for architecture x86_64:
"_OBJC_METACLASS_$_CLLocation", referenced from:
_OBJC_METACLASS_$_MyLocation in AppDelegate.o
"_OBJC_METACLASS_$_CLLocationManager", referenced from:
_OBJC_METACLASS_$_MyLocationManager in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
與此問題Error on CLLocation subclassing不同的是,我確實已經將正確的框架添加到項目中,並且正如我所說的,該設置完美地構建在iOS上,而不是爲OSX構建。
FWIW,我在iOS SDK 6.1和OSX SDK 10.8中使用Xcode 4.6.3,爲x86_64構建默認LLVM 4.2。
任何線索爲什麼會發生這種情況?
我嘗試了與Xcode5 DP3和OSX SDK 10.9相同,不同之處在於它會在啓動後使用:dyld:Symbol not found:_OBJC_METACLASS _ $ _ CLLocation'進行編譯但崩潰。這很有趣:P – Lvsti