Device ID - how to tell between iphone 4 and iphone 5

Hey! 
Could anyone tell me how to tell the difference between an iphone 4 and an iphone 5?

I tried looking on all the system.getInfo( “” ) stuff but i could find anything that distinguishes them!

Thanks! :wink:

 

I determine if the iOS device is iPhone 5 using this:

[lua]

if ( string.sub( system.getInfo(“model”), 1, 2 ) == “iP”

     and display.pixelHeight > 960 ) and (string.sub( system.getInfo(“model”), 1, 4 ) ~= “iPad”) then

     – this is iPhone5

else

     – this isn’t iPhone5

end

[/lua]

Naomi

@Naomi

This couldn’t be any clearer, and is exactly what i needed! 
Once my app is complete with the next update i will message you with a free code! I hope you will like it!

Cool.  Thanks!

Naomi

Well the update just went up! - I had expedited review!

Thanks for the help! here is the itunes store link

https://itunes.apple.com/us/app/ice-bg-maker/id538005230?ls=1&mt=8

and i am going to find a way to message you the code!

Please tell me how you like it!

system.getInfo(“architectureInfo”)  will return something like iPhone5,1 for the iPhone 5.

Ah, that’s good to know, Rob.  Perhaps it’s time for me to update my code to work with it then.

Thanks!

Naomi

Actually I would probably still use your method Naomi.  When the iPhone 5s comes out, you are going to have to deal with “iPhone 5,2” where as looking at the pixel height is more important for screen things.

Ah, okay, got it.  I was thinking of doing string.sub, and if it finds “iPhone 5” (or whatever it is it’s suppose to return)I’d consider it iPhone 5 device, but perhaps it’s too much trouble for what it’s worth.

Thanks for the follow up.

Naomi

I determine if the iOS device is iPhone 5 using this:

[lua]

if ( string.sub( system.getInfo(“model”), 1, 2 ) == “iP”

     and display.pixelHeight > 960 ) and (string.sub( system.getInfo(“model”), 1, 4 ) ~= “iPad”) then

     – this is iPhone5

else

     – this isn’t iPhone5

end

[/lua]

Naomi

@Naomi

This couldn’t be any clearer, and is exactly what i needed! 
Once my app is complete with the next update i will message you with a free code! I hope you will like it!

Cool.  Thanks!

Naomi

Well the update just went up! - I had expedited review!

Thanks for the help! here is the itunes store link

https://itunes.apple.com/us/app/ice-bg-maker/id538005230?ls=1&mt=8

and i am going to find a way to message you the code!

Please tell me how you like it!

system.getInfo(“architectureInfo”)  will return something like iPhone5,1 for the iPhone 5.

Ah, that’s good to know, Rob.  Perhaps it’s time for me to update my code to work with it then.

Thanks!

Naomi

Actually I would probably still use your method Naomi.  When the iPhone 5s comes out, you are going to have to deal with “iPhone 5,2” where as looking at the pixel height is more important for screen things.

Ah, okay, got it.  I was thinking of doing string.sub, and if it finds “iPhone 5” (or whatever it is it’s suppose to return)I’d consider it iPhone 5 device, but perhaps it’s too much trouble for what it’s worth.

Thanks for the follow up.

Naomi