0

有没有办法检测你正在运行的 iOS 模拟器。即运行 5.1 与 6.1 的区别。

使用 [[UIDevice currentDevice] systemVersion] return x86 所以我无法确定 6.1 模拟器和 7.0 模拟器之间的区别。

4

3 回答 3

0

你应该看看可用性

相关声明都在

Availability.h AvailabilityInternal.h

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
  // Here we go with iOS 6++
#else
  // This is the old way
#endif
于 2013-07-03T12:38:52.997 回答
0

这很容易!

斯威夫特版本:

if #available(iOS 11.0, *) {
} else {
}

Objective-C 版本:

if (@available(iOS 11.0, *)) {
} else {
}
于 2019-02-01T07:14:24.317 回答
0

[[UIDevice currentDevice] systemVersion] should give you the information you need. However, that is not something that should be used for logic. It is designed to be a user-presentable string.

If you want to make logic decisions, you should do it based on capabilities. For example, check for the existence of potentially-weak symbols at runtime before using them rather than making decisions based on the system version.

于 2015-11-29T21:04:43.493 回答