I’d like my iphone app to pre-populate some fields once a user has logged into gamecenter. Specifically, the username!
I have full logging in working – as well as a leaderboard and acheivements all working – I just can’t seem to find out how to access the users name property anywhere.
Any advice / help would be greatly appreciated.
Thanks,
Kolya
PS – This is my first question. Please be nice 🙂
Here is the code I’m trying:
if ([GameCenterManager isGameCenterAvailable]) {
self.gameCenterManager = [[[GameCenterManager alloc] init] autorelease];
[self.gameCenterManager setDelegate:self];
[self.gameCenterManager authenticateLocalUser];
NSLog(@"User alias: %@",[[GKLocalPlayer localPlayer]alias]);
But the NSLog outputs “User alias: (null)”?
As the local player is the subclass of GKPlayer, you could use this:
Oh.. you have not authenticate the user… It is the first step..
I think you can just replace the 3 lines of codes with the code above.. Should work..