What will [[UIDevice currentDevice] model] return for "iPad"?
Asked
Active
Viewed 1.3k times
2

Arun_
- 1,806
- 2
- 20
- 40

g.revolution
- 11,962
- 23
- 81
- 107
-
1This is under NDA, so your question is likely to be ignored until the NDA is lifted. The documentation states that `model` returns a string like "iPod Touch" or "iPhone" for those respective devices, so one cane make an educated guess.. – Jasarien Mar 26 '10 at 10:32
-
@Jasarien: If I am not wrong the sdk version beta_5 is not under NDA, Please correct me if I am wrong. – Madhup Singh Yadav Mar 29 '10 at 06:25
-
@Madhup, I believe it still is. At the iPhone Developer site, the warning is still in place that says: "iPhone SDK 3.2 beta 5 is pre-release software and is considered Apple Confidential Information." While it can be used to submit iPad apps, it is still under NDA. – Jasarien Mar 29 '10 at 08:31
4 Answers
3
I tried using containsString but it was not allowed with xcode4
Here is how I solved it:
if ([[[UIDevice currentDevice] model] hasPrefix:@"iPhone"])
{
Hope this helps even if its a bit late.

timv
- 3,346
- 4
- 34
- 43
2
You can use UI_USER_INTERFACE_IDIOM()
, which will either return UIUserInterfaceIdiomPhone
or UIUserInterfaceIdiomPad
. Bear in mind that on any device < 3.2, this is unavailable, so first check to see whether the property can be retrieved - in this case, it is not an iPad.
Or, alternatively, to specifically work out whether the platform is an iPad or not, use
if ([[[UIDevice currentDevice] model] containsString:@"iPad"]) {
// Your code goes here
}
Hope this helps ;)

jrtc27
- 8,496
- 3
- 36
- 68
1
Well trying on simulator:
NSLog(@"%@",[[UIDevice currentDevice] model]);
it gives iPad Simulator, will update the answer when I will get the device ;)

Madhup Singh Yadav
- 8,110
- 7
- 51
- 84
-
@g.revolution : then wait for somebody to get the device and post the answer ;) – Madhup Singh Yadav Mar 29 '10 at 13:59
-
tested this on an iPad 3G and it gave me "iPad" only. Was hoping to be bale to read 3G as well but was unlucky – Abolfoooud Jun 14 '11 at 15:08