gpt4 book ai didi

ios - 如何查看iOS版本?

转载 作者:行者123 更新时间:2023-11-30 11:48:17 25 4
gpt4 key购买 nike

我想检查设备的 iOS 版本是否高于 3.1.3我尝试过这样的事情:

[[UIDevice currentDevice].systemVersion floatValue]

但它不起作用,我只想要一个:

if (version > 3.1.3) { }

我怎样才能实现这个目标?

最佳答案

/*
* System Versioning Preprocessor Macros
*/

#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

/*
* Usage
*/

if (SYSTEM_VERSION_LESS_THAN(@"4.0")) {
...
}

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"3.1.1")) {
...
}

关于ios - 如何查看iOS版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48581355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com