Game center. Get real name

I want to know the real name of the local player, but GKLocalPlayer displayName returns "Me", not the real name.

The code I'm using is:

 void (^completitionHandler)(NSArray *, NSError *) = ^(NSArray *players, NSError *error) { 

    for (GKPlayer *p in players) {
      NSString *alies = p.alies;
      NSString *name = p.displayName;
      NSLog(@"name = %@",name);   //not real name, just "Me"
    }

 }
+5
source share
2 answers

Incorrect displayName can be used to get the fully qualified local user name. From the Apple Documentation :

Player Objects Provide Player Information

When your game needs details for a specific player, it retrieves this data by sending a request to Game Center. You retrieve information for a player using the player identifier. The Game Kit returns these details to your game in the GKPlayer object.

  • displayName :

    , . , , , .

    , , . , . , .

. , displayName , , "Me", . , .

:

, , . , , .

+4

[ GKLocalPlayer].

NSString *alias = [GKLocalPlayer localPlayer].alias
NSString *name = [GKLocalPlayer localPlayer].displayName
+3

All Articles