Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

As per this question I've found banners to cause slowdown on iOS 5, it turns out the "welcome, you have been signed in" Game Center message does this too, and on occasion it will interupt me several times in a game if I switch in/out of the app while playing as it logs be in/out repeatedly.

Is there a way to disable this notification while leaving Game Center enabled? I tried revoking the banner notification rights from Game Center but the pop up still appears.

share|improve this question

4 Answers 4

up vote 2 down vote accepted

That login banner is a provided aspect of the Game Center API in the iOS SDKs, as far as I'm aware there is no way as a developer to disable it from opening when the Game Center login completes. As a user, there is certainly no way to disable it, because it is part of the application's compiled source code.

However, note that it's not the banner that is causing the delays and skips. It is actually the entire login process to Game Center. My only advice is when you open a game that has Game Center logins, open it up to the first functional screen, and just wait the ~5-10 seconds it takes to reveal the Game Center banner. After the banner has displayed and disappeared, proceed normally and you should not be affected any further.

share|improve this answer
    
That's pretty much what I've been assuming –  Ben Brocka Feb 6 '12 at 18:25
    
Funny thing is, I was somewhere with no connectivity ("No service" in the menubar) and I still got the popup. –  Loïc Wolff Feb 6 '12 at 18:26
    
Unfortunately I don't know the Game Center APIs that well, but the 'Welcome' banner may appear when you have registered with Game Center generally. Online or not. Meaning that the app registered with Game Center in order to react appropriate to achievements, (cached) leaderboards, etc. Generally the Game Center storage. –  Jason Salaz Feb 6 '12 at 18:28

There does seem to be a way to disable Game Centre, but it's not obvious, or wasn't to me.

Sign out of Game Centre.

If you then start a Game Centre game it will pop up asking you to log in to Game Centre again.

Instead of logging in, press the Cancel button in the top left hand corner. Then Exit the game and repeat until you've opened the game and canceled the Game Centre login three times.

A new dialog pops up asking whether you wish to disable Game Centre. Start the game again and there is none of the Game Centre stuff popping up anymore.

So far this seems to have worked for me. The PITA has kept quiet for now.

share|improve this answer

Yes, it's possible to suppress the Game Center Welcome banner programmatically from within your app, at least under iOS 7. My approach is predicated on a few observations:

  1. The banner is presented as an additional UIWindow within your UIApplication.
  2. This window always seems to appear at index 1. (presuming your app only uses one window.)
  3. The banner is 66 pixels high on iPad, 64 on iPhone.
  4. The banner contains a 42x42 pixel subview for the Game Center icon.
  5. It's known when the banner is likely to appear. (i.e. within a few seconds of creating a GKLocalPlayer object on launch to test authentication.)

So you can simply poll your application's windows repeatedly over these few seconds, waiting for the extra window to appear. (Key-value observing is probably the "correct" way to do this, but I'm lazy.) When the window shows up, test whether it contains a subview hierarchy as described above, which indicates that it's probably the Game Center banner. If it is, set the alpha of the window to 0. That's it.

Here's some code that accomplishes this in my app. I call this method immediately after attempting to authenticate the local player, and it calls itself for a few seconds until it finds (and hides) the banner, or else times out:

- (void)suppressGCBanner:(id)object {
    int osVersion = [[[UIDevice currentDevice] systemVersion] intValue];
    if (osVersion != 7) return;  // only tested against iOS 7

    static int iter = 0;    // try for 4 seconds, typically takes about one second for banner to appear
    static int origWindowCount = 0;

    NSArray* windows = [UIApplication sharedApplication].windows;
    if (origWindowCount == 0) origWindowCount = (int)[windows count];

    BOOL ipad = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
    float bannerHeight = ipad ? 66.0f : 64.0f;  // GC banner has height 66 on iPad, 64 on iPhone

    if ([windows count] > origWindowCount) {
        NSLog(@"suppressGCBanner: found extra window, testing");

        UIWindow* window = [windows objectAtIndex:1]; // in my testing, the GC banner is always at index 1

        for (UIView* view in [window subviews]) {
            CGRect frame = view.frame;
            NSLog(@"subview size: %f, %f", frame.size.width, frame.size.height);

            if (frame.size.height != bannerHeight) continue;

            for (UIView* subview in [view subviews]) {
                CGRect frame = subview.frame;
                NSLog(@"sub-subview size: %f, %f", frame.size.width, frame.size.height);

                if (frame.size.width == 42.0f && frame.size.height == 42.0f) { // Game Center icon is 42x42
                    NSLog(@"found GameCenter banner: hiding. iter = %i", iter);

                    window.alpha = 0.0f; // make the window invisible!

                    return;
                }
            }
        }
    }

    if (++iter > 200) {
        NSLog(@"suppressGCBanner: timeout, bailing");
        return;
    }

    // ____ otherwise recurse
    [self performSelector:@selector(suppressGCBanner:) withObject:nil afterDelay:0.02f];
}

Once in a while you'll see a single-pixel line flicker at the top of the screen before the banner is hidden, but in general this method seems to work well enough. Use at your own risk, and enjoy!

share|improve this answer

Try this:

Settings > Notifications > Game Center

There you should see all of the options related to alerts, notifications, etc. which you can change, or disable completely.

share|improve this answer
1  
The "Welcome back, <YourGameCenterName>" message that appears when a game signs in to Game Center does not appear to be a standard Notification Center banner (it doesn't look like one, for starters), and isn't affected by those settings; I have GC Notifications turned off, and that message still appears. –  Dan J Jan 6 '12 at 22:36
    
As djacobson said and I indicated in the question, normal notification options don't work, this message seems to be it's own thing. –  Ben Brocka Jan 7 '12 at 2:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.