How can I programmatically check the iPad have iPadOS or iOS?
Thanks in advance.
How can I programmatically check the iPad have iPadOS or iOS?
Thanks in advance.
you can use systemName
keyword to identify the OSname of the device
systemName
The name of the operating system running on the device represented by the receiver.
so finally you need to use
Swift
let getOSName = UIDevice.current.systemName
print("device OS Name =\(getOSName)")
Objective C
NSString *getOSName = [[UIDevice currentDevice] systemName];
NSLog(@"device OS Name = %@", getOSName);
This sounds like a XY Problem. What do you want to determine with that test?
That said: make a version number check. 13.x and above is iPadOS, 12.x and below is iOS.
In Swift at runtime, this would be
if #available(iOS 13, *) {
// ipad os
} else {
// ios
}