I am working on a game that uses the portrait modes only. Devices that play the game in < iOS 6 work fine. In iOS 6 devices, the orientations are not filtered, allowing users to rotate the game into landscape modes that should be filtered out.
I am running:
xcode 4.5.1
Unity 3.5.6f4
Tested on an iPod touch 4 running iOS 6.0.1
Has anyone else run into this or found a workaround that Apple has approved? I have tried turning off animated rotations and forcing the default rotation into a single portrait option. The latter works, but I have heard that Apple will reject apps that do not allow at least right side up/upside down orientation changes.
If this is known and will be in a fix for 3.5.7, confirmation and any estimates on the release of 3.5.7 would be very much appreciated.
That never caught my eyes when browsing for reasons to reject. How have you done the filtering? I did mine with 3.5.6 in code, setting the allowed rotations there and setting autorotation on. My game worked only in landscape mode, and it didn’t rotate to portrait. If I remember correct, the supported rotations didn’t made it to the XCode project, so make sure you check there that only the allowed orientations are checked. This was the first google hit I found: Will Apple reject my iPad app if it doesn’t rotate?
EDIT: And I also very much think that 3.5.6 will be that last of 3.x series. Not a fact, but I seriously suspect they’re mainly working with 4.x branch now.
Thanks for the link about the rejection not being an issue; my source of concern was only other forum posts that I found when searching. With any luck, a non-rotating view will be solid backup plan. Although it still behaves oddly with a static orientation set: a freeze frame image and the black animating “rotation square” still flicker on screen as it seems to try and rotate, then the view snaps back to portrait. I assume these are just animation effects and that the rotation never changed, but I can’t be 100% positive.
I am setting my rotation from the editor player settings within Unity 3.5.6. I double checked xcode’s Supported Interface Options and it is reporting that the rotation options are correctly limited. I also tried setting the deployment target to 6.0…no luck. Where are you setting the rotation from code? assets\editor script files using PlayerSettings.allowedAutorotateToPortrait, etc?
Edit: If this is not a common issue, it is likely due to one of the plug-ins we are using. I’m looking into that now and will update if I can confirm it.
I had a similar rejection for my app. iOS 6 changed how they request supported orientations with autorotation. My game is Portrait on iPhone and Landscape on iPad so keep that in mind when you look at the code below. I use this code to replace the auto generated stuff from Unity’s build in AppDelegate.m. I have my rotations set to AutoRotate in the iOS Build settings.
// if on ios6 sdk - start old-school controller
#ifdef __IPHONE_6_0
@end
@implementation UnityViewController_preIOS6
#endif // __IPHONE_6_0
// this is part of old-school controller
// it goes for UnityViewController_preIOS6 (ios6 sdk) or to our own on older sdk
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone )
{
if(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
return YES;
}
else
{
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
return YES;
}
return NO;
}
// here goes new-style controller - only of built with ios6 sdk
#ifdef __IPHONE_6_0
@end
@implementation UnityViewController_IOS6
- (BOOL)shouldAutorotate
{
return (UnityRequestedScreenOrientation() == autorotation);
}
- (NSUInteger)supportedInterfaceOrientations
{
NSUInteger ret = 0;
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone )
{
ret |= (1 << UIInterfaceOrientationPortrait);
ret |= (1 << UIInterfaceOrientationPortraitUpsideDown);
}
else
{
ret |= (1 << UIInterfaceOrientationLandscapeRight);
ret |= (1 << UIInterfaceOrientationLandscapeLeft);
}
return ret;
}
#endif
@end
Thanks much gameyeti! A modified version of the above fixed my problems. The file and functions I needed to edit differed slightly though; I’ll post them to help anyone in a similar boat.
The file that I needed to edit: classes/AppController.mm
I needed to do changes similar to the above (although we only use portrait and upside down portrait on all devices) on the following functions in the classes for UnityViewController_andUnityVideoViewController_: shouldAutorotateToInterfaceOrientation supportedInterfaceOrientations
I also needed to limit orientations in the AppController function: supportedInterfaceOrientationsForWindow