1

How can I programmatically check the iPad have iPadOS or iOS?

Thanks in advance.

Piyush
  • 580
  • 1
  • 5
  • 23

2 Answers2

3

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);
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
1

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
}

Gereon
  • 17,258
  • 4
  • 42
  • 73