views:

213

answers:

2

Hi,

I need to get the iPhone model number from code. I can see the model number from my iPhone which is "MC143C", but when I am retrieving this by using code it is returning "iPhone". This is the code I am using to get the model number.

NSLog(@"model: %@", [[UIDevice currentDevice] model]);

Can anyone please help me to have the information i want to get from my device.

Thanks, !ZAQ

A: 

As usual, if some info cannot be found in the doc, it uses a private API.

In this case, Preferences.app uses IAP.framework to get the info.

KennyTM
Hi,Can you give some example? I tried but did not get any example for that. Thanking in advance,!ZAQ
zakirulq
@zak: Why do you need to know? If you write for AppStore you can't use this method.
KennyTM
A: 

I'm not sure the exact use case you have, but take a look at this: http://github.com/ars/uidevice-extension

It gets you pretty much all the relevant information. Not the exact model number, but you can get the base model (iPhone 3G) and all its capabilities as an ORed value of enumerations.

drharris