Orientation Change Doesn't work on 3gs but does on ipod touch ?

Hey guys.

I am adding auto rotation support to my app, which supports both landscape modes only.

This code works fine on the ipod touch (2nd gen), but doesn’t change orientation at all on my 3gs ??

I am using the director class.

Code :

mainGroup.xReference = display.contentWidth/2  
mainGroup.yReference = display.contentHeight/2  
mainGroup.rotation = currentRotation  
  
local function onOrientationChange( event )  
 local direction = event.type  
  
 if system.orientation == "landscapeRight" then  
 currentRotation = 90 - event.delta  
 elseif system.orientation == "landscapeLeft" then  
 currentRotation = 90 - event.delta  
 end  
  
 if system.orientation ~= "landscapeRight" or system.orientation ~= "landscapeLeft" then  
 currentRotation = 0  
 end  
  
 transition.to(mainGroup, {time=0, rotation=currentRotation} )  
 -- print(system.orientation)  
end  
   
Runtime:addEventListener("orientation", onOrientationChange)  

Build settings :

settings =  
{  
 orientation =  
 {  
 default ="landscapeRight",  
 supported =  
 {  
 "landscapeRight", "landscapeLeft"  
 },  
 },  
  
 iphone =  
 {  
 plist =  
 {  
 UIStatusBarHidden = true  
  
 },  
 },  
  
}  

Help on this would be greatly appreciated.

Btw is this even needed ? Shame our apps can’t just support auto orientation by our build settings file. [import]uid: 6981 topic_id: 6770 reply_id: 306770[/import]

I am having the exact same issue with my application. iPhone 4 (4.2.6) and iPad (4.2.1) handle it perfectly, however the 3GS (running 4.3) does not. [import]uid: 5090 topic_id: 6770 reply_id: 23702[/import]

Actually it appears you can remove the orientation change code and it will handle it fine all by itself. I am not sure at one point this changed, but it did not used to work that way in the early betas.

Once I removed the orientation change code the 3GS started working fine. Your build settings are fine however. [import]uid: 5090 topic_id: 6770 reply_id: 23703[/import]

What version of corona are you using though?

I tried the latest (268) but my game crashes on the device using it.

I had to revert to 243, as i can’t debug an error on the phone as i get no feedback :confused: [import]uid: 6981 topic_id: 6770 reply_id: 23854[/import]

Edit : It does work. Tested on my fathers iphone 3gs.

It was some cydia extension i had installed on my own 3gs that was preventing it from working.

Thanks for the info [import]uid: 6981 topic_id: 6770 reply_id: 23874[/import]

@infuseddreams, when you removed the orientation code to change the orientation of the screen image, does it just pop into the right direction or does it do the nice rotate animation?

For me, I can get the screen to pop into the right orientation, but to make it rotate into it, I need to take over and use a transtion.to, changing its rotation values.

Since I’m doing the animation myself, I’m not sure if I actually need to list the supported orientations in the build.settings file. It actually seems to work better without. But does Apple need the supported orientations explicitly stated? [import]uid: 9905 topic_id: 6770 reply_id: 26022[/import]