Когда игровой центр загружен, его ориентация по умолчанию - портрет. Чтобы заблокировать его в ландшафтном режиме, добавлена категория.
@implementation GKMatchmakerViewController (LandscapeOnly)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ( interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotate {
return NO;
}
@end
Он работает отлично в iOS 6. Но в iOS6 он показывает ошибку.
Завершение приложения из-за неперехваченного исключения "UIApplicationInvalidInterfaceOrientation", причина: "Поддерживаемые ориентации не имеют общей ориентации с приложением, а shouldAutorotate возвращает YES"
Пожалуйста, объясните решение.