Category to check hardware version that's running iOS
To get the platform identfier
NSString *platform = [UIDeviceHardware platform];
To get the platform name
NSString *platformString = [UIDeviceHardware platformString];
Category to check hardware version that's running iOS
License: MIT License
Category to check hardware version that's running iOS
To get the platform identfier
NSString *platform = [UIDeviceHardware platform];
To get the platform name
NSString *platformString = [UIDeviceHardware platformString];
Hey I'm using your framework in Xcode 9 ios 11.
The frameworks works, but it doesn't output the device number, only outputs the device.
NSString *platform = [UIDeviceHardware platform];
NSString *platformString = [UIDeviceHardware platformString];
NSLog (@"%@", platform);
NSLog (@"%@", platformString);
2017-12-04 12:07:10.493477-0500 Ruergern[15970:1432227] x86_64
2017-12-04 12:07:10.493652-0500 Ruergern[15970:1432227] iPhone
should be iPhone 7 plus
The iPad Air identifiers are not 100% correct. Here are the corrected values:
if ([platform isEqualToString:@"iPad4,2"]) return @"iPad Air (GSM)";
if ([platform isEqualToString:@"iPad4,3"]) return @"iPad Air (CDMA)";
Both iPad Mini Retina's now have iPad4,4, while the CDMA version should be iPad4,5
Consider adding these, because more and more devices can have apps like the Apple TV, Watch, and possibly HomePod and beyond:
if ([platform isEqualToString:@"iPhone3,2"]) return @"iPhone 4 (GSM, Rev A)";
if ([platform isEqualToString:@"AppleTV2,1"]) return @"Apple TV (2nd Gen)";
if ([platform isEqualToString:@"AppleTV3,1"]) return @"Apple TV (3rd Gen)";
if ([platform isEqualToString:@"AppleTV3,2"]) return @"Apple TV (3rd Gen)";
if ([platform isEqualToString:@"AppleTV5,3"]) return @"Apple TV (4th Gen)";
if ([platform isEqualToString:@"AppleTV6,2"]) return @"Apple TV 4K";
if ([platform isEqualToString:@"Watch1,1"]) return @"Apple Watch (1st Gen, 38mm)";
if ([platform isEqualToString:@"Watch1,2"]) return @"Apple Watch (1st Gen, 42mm)";
if ([platform isEqualToString:@"Watch2,3"]) return @"Apple Watch Series 2 (38mm)";
if ([platform isEqualToString:@"Watch2,4"]) return @"Apple Watch Series 2 (42mm)";
if ([platform isEqualToString:@"Watch2,6"]) return @"Apple Watch Series 1 (38mm)";
if ([platform isEqualToString:@"Watch2,7"]) return @"Apple Watch Series 1 (42mm)";
if ([platform isEqualToString:@"Watch3,1"]) return @"Apple Watch Series 3 (Cellular, 38mm)";
if ([platform isEqualToString:@"Watch3,2"]) return @"Apple Watch Series 3 (Cellular, 42mm)";
if ([platform isEqualToString:@"Watch3,3"]) return @"Apple Watch Series 3 (GPS, 38mm)";
if ([platform isEqualToString:@"Watch3,4"]) return @"Apple Watch Series 3 (GPS, 42mm)";
if ([platform isEqualToString:@"AirPods1,1"]) return @"AirPods";
if ([platform isEqualToString:@"AudioAccessory1,1"]) return @"HomePod";
And changing to these so that we can see which cell type the device has:
if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone 7 (Global)";
if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus (Global)";
if ([platform isEqualToString:@"iPhone9,3"]) return @"iPhone 7 (GSM)";
if ([platform isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus (GSM)";
if ([platform isEqualToString:@"iPhone10,1"]) return @"iPhone 8 (Global)";
if ([platform isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus (Global)";
if ([platform isEqualToString:@"iPhone10,3"]) return @"iPhone X (Global)";
if ([platform isEqualToString:@"iPhone10,4"]) return @"iPhone 8 (GSM)";
if ([platform isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus (GSM)";
if ([platform isEqualToString:@"iPhone10,6"]) return @"iPhone X (GSM)";
Hello, this looks really usefull, thanks for writing it. Is there any way that I can learn how to use it in web based applications? I have an idea and would like to extend it to serve up correct URL schemes based on device. Wouldn't that be awesome?
if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s Plus";
if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s";
you should fix to this:
if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
Does UIDeviceHardware only work for real devices?
On iPhone X simulator, NSString *platformString = [UIDeviceHardware platformString];
returns "iPhone"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.