我在我的应用程序中使用第三方框架(metaioSDK),但 i386 版本中未提供该框架。我希望能够将其从模拟器构建中排除,以便我可以在模拟器上测试与该框架无关的功能。我按照这个问题的答案:How to exclude frameworks in simulator builds in Xcode并确保将使用此框架的任何代码包装在 #if/#else/#endif
中,如下所示:
// ARViewController.h
#import <UIKit/UIKit.h>
#if TARGET_IPHONE_SIMULATOR
@interface ARViewController : UIViewController {
}
@end
#else
#import <metaioSDK/MetaioCloudPlugin/MetaioCloudPluginViewController.h>
@interface ARViewController : MetaioCloudPluginViewController
{
bool m_useLocationAtStartup;
}
@end
#endif
同样,我更改了相关的 ARViewController.m
文件,以便在模拟器上运行时具有空白实现。
然而,Xcode 似乎仍然想要链接该框架的某些部分,并且我收到错误:
Undefined symbols for architecture i386:
"_fopen$UNIX2003", referenced from:
_BIO_new_file in metaioSDK(bss_file.o)
_file_ctrl in metaioSDK(bss_file.o)
_open_console in metaioSDK(ui_openssl.o)
"_fputs$UNIX2003", referenced from:
_write_string in metaioSDK(ui_openssl.o)
_read_string in metaioSDK(ui_openssl.o)
"_fwrite$UNIX2003", referenced from:
_XrAQWOpNWyNOaebKZvBRbL in metaioSDK(pngwio.o)
_file_write in metaioSDK(bss_file.o)
_int_rsa_verify in metaioSDK(rsa_sign.o)
_send_fp_chars in metaioSDK(a_strex.o)
_write_fp in metaioSDK(b_dump.o)
_read_string in metaioSDK(ui_openssl.o)
"_nanosleep$UNIX2003", referenced from:
boost::this_thread::hiden::sleep_for(timespec const&) in metaioSDK(thread.o)
boost::this_thread::hiden::sleep_until(timespec const&) in metaioSDK(thread.o)
"_strerror$UNIX2003", referenced from:
_build_SYS_str_reasons in metaioSDK(err.o)
"_strtod$UNIX2003", referenced from:
_WWOVfTQLpCQpcac in metaioSDK(pngrutil.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
除了将此框架标记为可选之外,我还缺少什么?
最佳答案
问题是您的第三方框架确实包含 i386 版本,但该 i386 版本是针对错误的 SDK 构建的。它是针对 OS X SDK 构建的,并且应该是针对 iOS Simulator SDK 构建的。向metaioSDK 开发人员提交错误报告,让他们修复错误。
关于ios - 从 iOS 模拟器构建中排除框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26655924/