【问题标题】:Excluding framework from iOS Simulator build从 iOS 模拟器构建中排除框架
【发布时间】:2014-10-30 14:40:28
【问题描述】:

我在我的应用程序 (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)

除了将此框架标记为可选之外,我还缺少什么?

【问题讨论】:

  • 同样的情况。目前有解决方案吗?

标签: ios ios-simulator


【解决方案1】:

问题在于您的第三方框架确实包含 i386 版本,但该 i386 版本是针对错误的 SDK 构建的。它是针对 OS X SDK 构建的,应该是针对 iOS Simulator SDK 构建的。向 metaioSDK 开发人员提交错误报告,让他们修复错误。

【讨论】:

    【解决方案2】:

    如果您复制目标并将框架从链接框架列表中删除,您可以使用这个新目标为模拟器构建。它少了一点“只知道我想要什么,然后做这件事”,但它肯定会解决您的问题,并且会明确标记关系。

    【讨论】:

      猜你喜欢
      • 2011-04-28
      • 2020-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-08
      • 2018-07-01
      • 1970-01-01
      • 2023-03-09
      相关资源
      最近更新 更多