How to get GKPlayer status from Game Center?

When I get GKLocalPlayeror use loadPlayersForIdentifiers:identifiers withCompletionHandler:to retrieve a list or individual aliases GKPlayer, the object GKPlayerupon registration looks something like this:

2010-09-23 10:39:01.759 Cee-lo[76500:207] Players loaded by identity: (
    "<GKPlayer 0x84125a0>(playerID: G:1234567890, alias: typeonetester1, status: Adding test friends., rid:(null))",
    "<GKPlayer 0x8412530>(playerID: G:1234567890, alias: typeonetester2, status: Adding Game Center to app, rid:(null))"
)

My question is: how do I get statusfrom this object, and what exactly is the type of this object? There is no "rid" or "status" property in the GKPlayer class , so when I do something like:

GKPlayer *player = [self.friends objectAtIndex:row];

cell.nameLabel.text = player.alias;
cell.statusLabel.text = player.status;

I get a "Member Status Request" error in a non-structure or union error.

+3
source share
2 answers

Apple:

. - 4.1 4.1 relnotes.

+2
NSString *desc = player.description;
NSRange range = [desc rangeOfString:@"status:"];
NSString *status = [[desc substringFromIndex:NSMaxRange(range)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
+1

Source: https://habr.com/ru/post/1766267/


All Articles