Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GameCenter notification banner appears "squished" sometimes - what could be causing this?

I have an app that uses GameCenter in a very simple way (just a simple leaderboard with an all time high score). Sometimes when I switch to my app I'll see the notification saying "welcome back to Game Center" but sometimes this notification appears squished like in the following image:

http://i.imgur.com/KOCFIJo.jpg

Does anybody know what might the causing this? Because I have absolutely no idea.

My authentication code which generates the notification banner is fairly standard.

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

    [GKLocalPlayer localPlayer].authenticateHandler = ^(UIViewController *viewController, NSError *error) {
        // If there is an error, do not assume local player is not authenticated.
        if (localPlayer.isAuthenticated) {

            // Enable Game Center Functionality
            self.gameCenterAuthenticationComplete = YES;
            [self enableGameCenter:YES];
            gameCenterButton.enabled=true;

        } else {
            NSLog(@"game center not logged in");
            // User has logged out of Game Center or can not login to Game Center, your app should run
            // without GameCenter support or user interface.
            self.gameCenterAuthenticationComplete = NO;
            [self enableGameCenter:NO];
            [self presentViewController:viewController animated:true completion:nil ];
            gameCenterButton.enabled=false;

        }
    };

One additional piece of information is that my app is in portrait orientation when this problem occurs. It seems like if I rotate my phone 90 degrees while the banner is showing, it will look normally in landscape but in portrait it looks all squished. Does this help explain it?

like image 607
Jackson Avatar asked Nov 02 '22 11:11

Jackson


1 Answers

I figured it out. I hadn't implemented preferredInterfaceOrientationForPresentation so I did that

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

And also I made sure that supportedInterfaceOrientations returend UIInterfaceOrientationMaskPortrait (note that it returns UIInterfaceOrientationMASKPortrait not just UIInterfaceOrientationPortrait). After that everything worked fine.

- (NSUInteger)supportedInterfaceOrientations
{
    return  UIInterfaceOrientationMaskPortrait;
}
like image 52
Jackson Avatar answered Nov 12 '22 12:11

Jackson