swift
#if (arch(i386) || arch(x86_64)) && os(iOS)
...
#endif
swift 4.1 后
#if targetEnvironment(simulator)
// your simulator code
#else
// your real device code
#endif
原来可以这么写
#if TARGET_OS_IPHONE
#endif
#if !TARGET_IPHONE_SIMULATOR
#endif
参考
ios - How to detect if app is being built for device or simulator in Swift - Stack Overflow
Apple Developer Documentation
最后
以上就是无奈铃铛最近收集整理的关于ios swift 宏定义Ifdef 模拟器 真机的全部内容,更多相关ios内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复