Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8983673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:53:54+00:00 2026-06-15T20:53:54+00:00

I’m in sandbox mode implementing game center in my application. The problem comes when

  • 0

I’m in sandbox mode implementing game center in my application. The problem comes when I log to gameCenter, in some devices works fine in some others I get a GKErrorCanceled without even get the interface shown.

This devices don’t have any user logged in gameCenter so it’s not related to have a non sandbox account logged. My code is:

       GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

    //First we try the new iOS6 authentification method for gamekit, if it's not implemented we will use the deprecated one
    if ([localPlayer respondsToSelector:@selector(setAuthenticateHandler:)]) {
        if (localPlayer.isAuthenticated) {
            this->setState(connectionLoged);
            this->getDelegate().socialConnectionDidSucceedLogin(*this);
            return;
        }
        else if(!localPlayer.isAuthenticated && localPlayer.authenticateHandler){
            this->setState(connectionClosed);
            this->getDelegate().socialConnectionDidFailToLogin(*this, std::string("The user already resign to login"));
            return;
        }

        else{
            localPlayer.authenticateHandler = ^(UIViewController* viewController, NSError* error){
                if (localPlayer.isAuthenticated)
                {
                    _name = [localPlayer.displayName UTF8String];
                    _userId = [localPlayer.playerID UTF8String];

                    [GKPlayer loadPlayersForIdentifiers:localPlayer.friends withCompletionHandler:^(NSArray *players, NSError *error) {
                        for (GKPlayer* player in players) {
                            if ([player isFriend]) {
                                NSDictionary* dict =
                                @{@"displayName" : player.displayName,
                                @"alias" : player.alias,
                                @"playerID" : player.playerID};

                                AttrDictionary* playerInfo = [dict hydraAttrDictionary];
                                SocialFriend* socialfriend = this->getNewFriendInstance(*playerInfo);

                                this->addFriend(socialfriend);

                                delete playerInfo;
                            }
                        }

                        this->getDelegate().socialConnectionDidSucceedLogin(*this);
                        this->setState(connectionLoged);

                    }];
                }
                else if(viewController){
                   UIViewController* rootViewController = (UIViewController*) [UIApplication sharedApplication].keyWindow.rootViewController ;
                    [rootViewController presentModalViewController:viewController animated:YES];
                }
                else{
                    if(error){
                        this->getDelegate().socialConnectionDidFailToLogin(*this, std::string([error.description UTF8String]));
                    }
                    else{
                        this->getDelegate().socialConnectionDidFailToLogin(*this, std::string("User cancelled login"));
                    }
                }

            };
        }
    }
//deprecated at IOs 6 authentification method
else
    [localPlayer authenticateWithCompletionHandler:^(NSError *error) {
        if (localPlayer.isAuthenticated)
        {
            _name = [localPlayer.displayName UTF8String];
            _userId = [localPlayer.playerID UTF8String];

            [GKPlayer loadPlayersForIdentifiers:localPlayer.friends withCompletionHandler:^(NSArray *players, NSError *error) {
                for (GKPlayer* player in players) {
                    if ([player isFriend]) {
                        NSDictionary* dict =
                        @{@"displayName" : player.displayName,
                        @"alias" : player.alias,
                        @"playerID" : player.playerID};

                        AttrDictionary* playerInfo = [dict hydraAttrDictionary];
                        SocialFriend* socialfriend = this->getNewFriendInstance(*playerInfo);

                        this->addFriend(socialfriend);

                        delete playerInfo;
                    }
                }

                this->getDelegate().socialConnectionDidSucceedLogin(*this);
                this->setState(connectionLoged);

            }];


        }
        else{
            NSString* errorString = [error localizedDescription];

            this->getDelegate().socialConnectionDidFailToLogin(*this, std::string([errorString UTF8String]));
            this->setState(connectionClosed);
        }
    }];

I need the code compatible with iOS 6 and iOS 5 so you will see I have the two implementations. For iOS 6 the completion handler returns with an UIViewController null and the error as I say. I’m afraid that in production it happends the same. In the simulator all works fine.

PS- You will find some c++ code, it’s because I implement a c++ wrapper for GameCenter as my game is write in cocos2dx…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:53:55+00:00Added an answer on June 15, 2026 at 8:53 pm

    When someone cancels out of the interface to sign in to game center, it will give you GKErrorCanceled. The third time in a row that they cancel, it will warn them that it will disable game center.

    If they do choose to disable game center, then it won’t show the interface anymore, and it will just give you GKErrorCanceled instead.

    Once game center has been disabled, the only way to sign in is by going into the actual game center app.

    The 3 times in a row could be in any app or any combination of apps that use game center, and game center will be disabled for all apps that use game center. The 3 times in a row restarts every time they sign in to game center.

    This is for both sandbox and non-sandbox.

    This is for both ios 5 and ios 6.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have been unable to fix a problem with Java Unicode and encoding. The
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.