Corona SDK system.orientation returns wrong value on iphone?

I noticed that system.orientation when starting the application gives the default orientation defined in build.settings for iphone5S. I tested the same code on iPad2 and iPadMini and get the correct answer, but with iphone5S I always get the default build.settings setting no matter what orientation the application starts in, any hints or ideas?

build.settings

orientation = {
    default = "portrait",
supported = {
  "landscapeLeft", "landscapeRight", "portrait", "portraitUpsideDown"
}

main.lua

print ( system.orientation ) -- gives wrong answer on iphone5S but not ipad2 or ipad Mini ?

I use print as an example, I am really sending a string to the device screen.

Basically, I have to turn 5S to start getting the correct orientation information, by default tit always says “portrait”. Which, as you can imagine, is annoying to say, at a minimum, my application on iphone5S.

: 2013.2100 (2013.12.7)

+3
1

.

iPad system.orientation... iPhone , ! , , - ,

if (deviceType.isApple and not deviceType.is_iPad) then
    system.setAccelerometerInterval(100)   -- Make sure we capture first orientation change by ramping up the sample to 100Hz
    Runtime:addEventListener("orientation", initialOrientationSet) -- capture this first change
else
  -- Launch your app
end

initialOrientationSet :

function initialOrientationSet ()
  Runtime:removeEventListener("orientation", initialOrientationSet)
  system.setAccelerometerInterval (10) -- save some battery power
  -- Launch you app
end

.

0

All Articles