3 回答

TA貢獻(xiàn)1795條經(jīng)驗(yàn) 獲得超7個(gè)贊
更新
isOperatingSystemAtLeastVersion
NSProcessInfo
NSOperatingSystemVersion ios8_0_1 = (NSOperatingSystemVersion){8, 0, 1}; if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:ios8_0_1]) { // iOS 8.0.1 and above logic } else { // iOS 8.0.0 and below logic }
if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)]) { // conditionally check for any version >= iOS 8 using 'isOperatingSystemAtLeastVersion'} else { // we're on iOS 7 or below}
原文答案IOS<8
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { // Load resources for iOS 6.1 or earlier} else { // Load resources for iOS 7 or later}

TA貢獻(xiàn)1788條經(jīng)驗(yàn) 獲得超4個(gè)贊
我知道我回答這個(gè)問題太遲了。我不確定我的方法是否仍然適用于低iOS版本(<5.0):
NSString *platform = [UIDevice currentDevice].model;
NSLog(@"[UIDevice currentDevice].model: %@",platform);
NSLog(@"[UIDevice currentDevice].description: %@",[UIDevice currentDevice].description);
NSLog(@"[UIDevice currentDevice].localizedModel: %@",[UIDevice currentDevice].localizedModel);
NSLog(@"[UIDevice currentDevice].name: %@",[UIDevice currentDevice].name);
NSLog(@"[UIDevice currentDevice].systemVersion: %@",[UIDevice currentDevice].systemVersion);
NSLog(@"[UIDevice currentDevice].systemName: %@",[UIDevice currentDevice].systemName);
您可以得到以下結(jié)果:
[UIDevice currentDevice].model: iPhone
[UIDevice currentDevice].description: <UIDevice: 0x1cd75c70>
[UIDevice currentDevice].localizedModel: iPhone
[UIDevice currentDevice].name: Someones-iPhone002
[UIDevice currentDevice].systemVersion: 6.1.3
[UIDevice currentDevice].systemName: iPhone OS
- 3 回答
- 0 關(guān)注
- 696 瀏覽
添加回答
舉報(bào)