ios simulator - How to determine on which iPhone my App is running? -


i looked around find, how can know on iphone app running (iphone 3g, iphone3gs, iphone 4) additional things depending on device. preferred method this:

size_t size; sysctlbyname("hw.machine", null, &size, null, 0);  char *name = (char *)malloc(size); sysctlbyname("hw.machine", name, &size, null, 0); nsstring *machine = [nsstring stringwithcstring:name]; free(name); if([machine compare:@"iphone3,1"]==nsorderedsame){     //iphone 4 }else if([machine compare:@"i386"]==nsorderedsame){     //simulator }else{     //iphone 3gs, 3g...  } nslog(@"device %@", machine); 

this worked fine far, updated x-code , simulator. possible run simulator iphone 4, iphone3gs or iphone3g. how can detected @ runtime? solutions or workarounds far?

edit: solution here http://iphonedevelopment.blogspot.com/2009/05/device-detection.html of course isn't working anymore, since simulator can iphone4!

never coded iphone, googled , found this: apple developer: uidevice class

or maybe helps: iphone - how detect iphone version?


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -