Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detecting iPhone app running on iPad in compatibility mode

My iPhone app is not universal but it has a feature that I'd like to enable for people playing on iPads. Is there some way to detect that you're running on an iPad in compatibility mode? The UIDevice methods for detecting machine specs all return the values you would get on an iPhone (on the simulator at least). The only thing I can think of is detecting OS 3.2, but that technique won't work for long.

like image 625
n8gray Avatar asked Jul 14 '10 00:07

n8gray


People also ask

How do I turn off compatibility mode on my iPad?

What compatibility mode exactly? If you right click on the iTunes shortcut, then on Properties, then on the Compatibility tab, you can change or turn off the Windows Compatibility mode it may have applied.

Can I run iPhone apps on iPad?

Some iOS apps are for iPhone only, but that doesn't mean you can't download iPhone apps onto an iPad and use them on iPad too. Many iPad users would rather use the scaled up iPhone version of an app that is intended for a different screen device than no version of the app at all.


1 Answers

Originally answered here: https://stackoverflow.com/a/14864400/577237

Reposted since it's so short:

If the app is an iPhone app running in the emulator mode on an iPad, it will have a userInterfaceIdiom of Phone, but a model type of iPad. You can check this with the following code:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone &&
    [[[UIDevice currentDevice] model] hasPrefix:@"iPad"]) {
    // This app is an iPhone app running on an iPad
}
like image 150
mpatzer Avatar answered Nov 05 '22 06:11

mpatzer