代码之家  ›  专栏  ›  技术社区  ›  titaniumdecoy Mr. T

如何在Xcode中排除模拟器构建中的框架

  •  5
  • titaniumdecoy Mr. T  · 技术社区  · 14 年前

    在编译应用程序以在模拟器上运行时,如何从Xcode项目中排除仅为iOS设备体系结构(libssh2等)编译的库?

    1 回复  |  直到 14 年前
        1
  •  1
  •   Community CDub    8 年前

    我知道这是个老问题,但如果有人还在寻找答案,你可以用 弱连接 指定某些库是 .

    this answer for how to define a weak/optional link in XCode 4

    然后,在通常使用这些特性的代码中,可以在编译时使用

    #if TARGET_IPHONE_SIMULATOR
    
      NSLog(@"I'm in the simulator");
    
    #endif
    

    或者在运行时通过检查

      [[UIDevice currentDevice] model]
    

    并且以编程方式避免使用模拟器环境中不存在的库。