ios gaming services are not asynchronous

0 votes
Hi there,

I think ios gaming services like ScoreBoardService should be asynchronous. It hangs and it is not good.

Is there any plan on making ios gaming services asynchronous?

Thanks.
asked Apr 19, 2014 in App42 Cloud API-BaaS by telltale (30 points)

1 Answer

0 votes
 
Best answer

Hi,

Yes, we are working on it and we will update you once it is out .

But for now, you can call these API on separate threads to solve this problem.

For example:

-(void)saveScoreToApp42Server

{

    [self performSelectorInBackground:@selector(saveScore) withObject:nil];

}

 

-(void)saveScore

{

    ScoreBoardService *scoreboardService = [App42API buildScoreBoardService];

    @try

    {

        NSString *userName = @"User_Name";

        NSString *gameName = @"Game_Name";

        double gameScore = 200;

        Game *game = [scoreboardService saveUserScore:gameName gameUserName:userName gameScore:gameScore];

        [self performSelectorOnMainThread:@selector(onSaveScoreResponse:) withObject:game waitUntilDone:NO];

    }

    @catch (App42Exception *exception)

    {

        [self performSelectorOnMainThread:@selector(onSaveScoreResponse:) withObject:exception waitUntilDone:NO];

    }

    @finally

    {

    }

}

-(void)onSaveScoreResponse:(id)response

{

    /*

     * Handle response here.

     */

    

    if ([response isKindOfClass:[Game class]])

    {

        // For success response

    }

    else

    {

        // For exceoption

        App42Exception *exception = (App42Exception*)response;

        NSLog(@"Exception = %@",[exception reason]);

        NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);

        NSLog(@"App Error Code = %d",[exception appErrorCode]);

        NSLog(@"User Info = %@",[exception userInfo]);

    }

}

Thanks.

answered Apr 21, 2014 by rajeev.etc (1,660 points)
selected Apr 21, 2014 by telltale
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...