Checking if the device is an iPhone or iPod Touch

Member
Posts: 353
Joined: 2002.04
Post: #1
I've done some searching but can't find this out, is there a way to check whether your app is running on an iPhone or iPod Touch? I'm putting in some graphics options for Slope Rider and I want different default configurations for iPhones to iPod Touches.

I've read that 2XL Supercross has different numbers of computer players on different devices so I'm guessing it is possible somehow.

Thanks for any help.
Quote this message in a reply
Apprentice
Posts: 13
Joined: 2009.03
Post: #2
I don't have device to test this now, but I think you can use UIDevice to determine whether it is iPhone or iPod Touch.

Code:
NSLog(@"name = %@",[[UIDevice currentDevice] name]);

iPlayful : games for iPhone and iPod Touch
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #3
sthaqu Wrote:I don't have device to test this now, but I think you can use UIDevice to determine whether it is iPhone or iPod Touch.

Code:
NSLog(@"name = %@",[[UIDevice currentDevice] name]);

That wont work, it just returns the name of the device which the user can set to anything.

You need to use
Code:
if ([[[UIDevice currentDevice] model] isEqualToString: @"iPhone"])

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Member
Posts: 353
Joined: 2002.04
Post: #4
kodex Wrote:You need to use
Code:
if ([[[UIDevice currentDevice] model] isEqualToString: @"iPhone"])

Awesome, thanks kodex. Is this a generally alright thing to be doing? Users will be able to ramp up the graphics settings anyway, it's just for setting the defaults.

With an eye to the future (and Apple releasing an updated iPhone soon-ish) will there be a way to test which generation a user has?
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #5
monteboyd Wrote:With an eye to the future (and Apple releasing an updated iPhone soon-ish) will there be a way to test which generation a user has?

If I recall correctly I have used it in the past to detect which model of touch the user has (for speaker access and such), so I would imagine you could do something with the iPhones, play around with it on different devices.

I wouldn't worry to much about graphic settings though, the iPhone and Touch run at very similar speeds, tweaking the settings may not be worth the effort.

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Member
Posts: 353
Joined: 2002.04
Post: #6
I'll play around with it on different devices, thanks.

I am actually adding the graphics options after seeing it on a friend's iPhone (I only have a touch myself) and there are significant framerate differences. I'll be testing soon to see if the optimisations I've added help on iPhones, they certainly bump up the framereate on my Touch.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  what iPhone device versions to target for physics based games? mixedup 3 1,316 Sep 30, 2013 01:22 PM
Last Post: mawigator
  Line Smooth Problem on iPhone Device abelix 1 4,167 Sep 22, 2010 06:28 AM
Last Post: Skorche
  Checking for architecture? Bersaelor 2 2,677 Sep 20, 2010 11:56 AM
Last Post: Rasterman
  How much can I stuff in to video ram? (on iPhone/iPod touch) Jamie W 9 9,895 Aug 6, 2010 05:23 AM
Last Post: mariocaprino
  Pause/Resume on IPod touch tonysameh 0 2,358 Jul 26, 2010 06:34 AM
Last Post: tonysameh