我正在尝试使用一个静态库,其中的类别在运行时未被使用。没有编译时错误,但当我尝试运行时,会出现标准的“向实例发送无法识别的选择器”错误消息,并导致我的应用程序崩溃。
许多解决方案建议将
无论我是否有这些链接器标志,或者两者都有,我得到的是完全相同的错误集合。
不确定这是否是罪魁祸首,还是巧合,但更仔细地查看这些错误后,似乎它们全部来自于我正在使用的两个第三方库之一。一个作为已安装的.framework文件,另一个作为常规静态库。也许我需要对它们的构建进行一些处理(如果可能的话)?谢谢!
许多解决方案建议将
-ObjC -all_load
添加到应用程序目标的“其他链接器标志”属性中(还有许多其他人说,自XCode 4以来,这不再需要,这就是我为什么要包括XCode版本的唯一原因)。我已经尝试过了,但在构建过程中得到了115个错误:
Undefined symbols for architecture i386:
"_CLLocationCoordinate2DMake", referenced from:
-[QMapElement init] in libQuickDialog.a(QMapElement.o)
"_OBJC_CLASS_$_MKMapView", referenced from:
objc-class-ref in libQuickDialog.a(QMapViewController.o)
"_OBJC_CLASS_$_MKPinAnnotationView", referenced from:
objc-class-ref in libQuickDialog.a(QMapViewController.o)
"std::istream::gcount() const", referenced from:
GT::AES::decode(std::istream&, std::ostream&, unsigned int&, bool) in GD(gtaes.o)
GT::AES::encode(std::istream&, std::ostream&, unsigned int&, bool) in GD(gtaes.o)
"std::string::find_first_of(char const*, unsigned long, unsigned long) const", referenced from:
-[GDSetPasswordViewController checkPasswordStrength:] in GD(GDSetPasswordViewController.o)
GD::EacpCReq::EacpCReq(std::string, std::string, GT::Dbb&) in GD(GDEacpCommands.o)
GD::RawSocket::connect() in GD(GDRawSocket.o)
"std::string::copy(char*, unsigned long, unsigned long) const", referenced from:
GD::Socket::toString() const in GD(GDSocket.o)
(等等,这是其中的5或6个)。无论我是否有这些链接器标志,或者两者都有,我得到的是完全相同的错误集合。
不确定这是否是罪魁祸首,还是巧合,但更仔细地查看这些错误后,似乎它们全部来自于我正在使用的两个第三方库之一。一个作为已安装的.framework文件,另一个作为常规静态库。也许我需要对它们的构建进行一些处理(如果可能的话)?谢谢!