Skip to content

Possible oversight with availabilityChanged delegate method #72

@StewThom

Description

@StewThom

Having checkGameCenterAvailability: run in the initialisation of the class means that the availabilityChangeddelegate method will never get called under the following circumstances,
• No internet
• Device does not support Game Center
• User has declined the sign in screen in the past

This is due to the initialisation being called before the delegate is set and the delegate cannot be set without first initialising the class.

I have a workaround by wrapping the delegate call backs in a dispatch block like so:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
      NSDictionary *errorDictionary = @{@"message": @"Player is not signed into GameCenter, has 
      declined to sign into GameCenter, or GameKit had an issue validating this game / app.", @"title":  
      @"Player not Authenticated"};

       if ([[self delegate] respondsToSelector:@selector(gameCenterManager:availabilityChanged:)])
              [[self delegate] gameCenterManager:self availabilityChanged:errorDictionary];
});

It is a slight oversight but possibly something you could look at changing in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions