How to distinguish iPad 1 from iPad 2 from Cocoa?

My app needs to know where the iPad microphone is, and the only way to find out if it works on the iPad or iPad 2, and act accordingly.

So - how to check the device model?

+3
source share
2 answers

To do just that, you need:

if(![[UIDevice currentDevice].model isEqualToString:@"iPad2"])
{
UIAlertView *alertView = [UIAlertView alloc] initWithTitle:@"Error" 
message:@"Microphone not present" 
delegate:self 
cancelButtonTitle:@"Dismiss" 
otherButtonTitles: nil];
[alertView show];
[alertView release];
}

Taken from here

But, as I said above, it would be better to check for a microphone than for an exact model. What if someone uses an iPad 1 with an external microphone?

EDIT: This is the correct method , apologies, Merlin.

Also considered fooobar.com/questions/230627 / ...

Dave

+2
source

SO sysctlbyname("hw.machine"....

(iPhone, iPod Touch) iPhone SDK

+2

All Articles