views:

84

answers:

2

So I'm currently using UI_USER_INTERFACE_IDIOM in conjunction with [[UIDevice currentDevice] model] to check if I'm on an iPhone, iPod or iPad. What I've found is that in the iPad simulator 3.2, UI_USER_INTERFACE_IDIOM still evaluates to UIUserInterfaceIdiomPhone (iPhone).

I'm wondering if this has something to do with my Targeted Device Family setting. I'm only targeting iPhone for my App (I don't want to make a universal app with scaling views). However, I support the 3.2 SDK so I still want users that have an iPad to be able to run my iPhone app. Will UI_USER_INTERFACE_IDIOM evaluate correctly on the iPad even when I'm targeting iPhone?

+1  A: 

UI_USER_INTERFACE_IDIOM does not check if the device is an iPhone or iPad. What it checks is whether the user interface is in iPhone mode (the 1x/2x thing) or iPad mode.

If an app isn't configured to target iPad, it will always return UIUserInterfaceIdiomPhone because the UI is an iPhone app. It is a feature by design.

And even if the app is configured to target iPhone only, the iPad should be able to run it without any problems as long as you use the methods as documented.

(If you need iPad-specific capabilities, do not check whether the device really is an iPad. Instead, check for individual capability.)

KennyTM
I'm trying to determine whether or not to link phone numbers to phone call actions based on the device's calling capability. There is a method or macro I could use to determine this?
unjust
@unjust: You can weakly link to CoreTelephony (I assume you're using CT), then check if some classes e.g. `CTCall` exists using NSClassFromString.
KennyTM
Will [[UIDevice currentDevice] model] come up as iPad? I am trying to make sure that only the iPad can auto-rotate.
Felixs