Reputation: 45
I have an app that runs on iPhone, however when I submit to Apple for review, they are testing it on iPad. How do I detect if it's running on iPad for an iPhone app? I tried using UIUserInterfaceIdiomPad
but apparently it works only for universal app but not iPhone app.
Upvotes: 0
Views: 810
Reputation: 52538
I'd take a step back and ask what you need that information for.
Every iPhone app can be run on an iPad or an iPod Touch. If you make the assumption that your app can make phone calls, then this assumption will obviously be wrong. The processor might be unexpectedly fast. But in principle, your app should just run unchanged, and the fact that Apple runs it on an iPad shouldn't make any difference to you. There are hundred thousands of iPhone apps that all run without any problem on an iPad, and without any developer work.
Your app will obviously not be told that the user interface is UIUserInterfaceIdiomPad because you have an iPhone app, and it is supposed to show the iPhone UI even on an iPad.
Upvotes: 2
Reputation: 4843
Try this UIDevice
Class Method
[[UIDevice currentDevice] name] // like "S R Nayak's iPhone"
[[UIDevice currentDevice] model] // like @"iPhone", @"iPod Touch"
[[UIDevice currentDevice] localizedModel] // localized version of model
[[UIDevice currentDevice] systemName] // like @"iPhone OS"
[[UIDevice currentDevice] systemVersion] // like @"4.0"
[[UIDevice currentDevice] uniqueIdentifier] // UDID, a unique string to identify the device
Otherwise you can check:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone &&
[[[UIDevice currentDevice] model] hasPrefix:@"iPad"]) {
// This app is an iPhone app but running on an iPad
}
Upvotes: 4
Reputation: 332
You can get the information from
[[UIDevice currentDevice] model]
Upvotes: 0