iphone - iPad:我可以使用编译器指令来区分模拟器和设备吗?

标签 iphone xcode ipad

我希望在 Objective-C 类中有一个编译器(预编译器)指令来区分模拟器构建和设备构建。

#if SIMULATOR
call testModule();
#else
call productionModule();
#endif

iPad/iPhone 的 X 代码中有这样的 #directive 吗?

最佳答案

#if TARGET_IPHONE_SIMULATOR
// simulator code
#else
//device code
#endif

关于iphone - iPad:我可以使用编译器指令来区分模拟器和设备吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3453615/

相关文章:

iphone - 如何使用 MailCore to Sample iPhone app 从邮件中检索 .xml 扩展附件

iphone - UIWebView 流媒体 YouTube 在 iPad 上无法全屏显示

ipad - UISplitViewController 更改主视图和详细 View 表单详细 View

iphone - navBar 内存泄漏

iphone - 合并具有相同 firedate 的 UILocalNotifications

ios - 在 iPhone 4 英寸屏幕中,它在模拟器中显示 3.5 英寸屏幕。请检查屏幕截图。可能是什么问题?

c++ - Xcode for MacOS Mojave 中的 C++ 项目需要 NSCameraUsageDescription

iOS ArcGIS.framework 太大,因此 .ipa 大小

iphone - 全屏 View 隐藏导航和标签栏 iphone

ios - 急救员不变