system.getInfo("model") == "iPhone4" works on simulator but not on device

I am building a universal app. I ran it in the simulator and have put in specific code to scale the app in my code. In the simulator
system.getinfo("model") -- returns "iPhone4" for the iPhone4 device simulator
On an actual iPhone4 device system.getinfo("model") -- returns "iPhone". As a workaround I have put an extra option in my if statement that checks if it is "iPhone" and display.contentWidth == 640 then I assume the device is an iPhone 4. This works.

Nice, thanks!

1
2
3
4
5
6
7
-- iPhone 4 Specific
                
isiPhone4 = false
                
if(system.getInfo("model") == "iPhone" and display.contentWidth == 640)then
    isiPhone4 = true
end

Something else others should be aware of, the Simulator WINDOW menu for "View As" lists "NexusOne" with no space, but the API call returns "Nexus One". "Galaxy Tab" is consistent though. Just a heads-up when using system.getInfo("model")

That looks like a bug on the Mac Simulator. iPhone4 skin should return the same string as on an actual device, "iPhone". I'll file a bug to have it fixed. Thanks.

views:1452 update:2011/10/11 22:13:38
corona forums © 2003-2011