How to retrieve and display game center login name (Swift)

Hello. I’m very new to iOS programming and I’m developing an instructional app about how to play a sport. The idea behind my app is to display who is playing on a court. The beacon would be near the court. While near the court, players with their own device and my app installed, would ‘Check in’ (as a current player; essentially the app would trigger a notification as a ‘current player’ and ‘current player standing’, info should be from Game Center leaderboard data) and the Estimote beacon would sense which players are near and signaling as ‘Check in’. I hope you understand the idea behind my project.

I’m struggling with what code to put together in my app that will grab the local user’s game center ID, and use that to display Game Center name and Game Center Leaderboard standing. The idea is to display or ‘advertise’ the current player(s) who checked in, allowing for anybody using the app to see who is playing and what their standing is.

I’ve been through a number of Swift tutorials to get me up and running with the instructional material I’ve put into the app. Mostly tableView based data. I’ve also been through a few tutorials to play with and test the functionality of my Estimate beacons including ranging and changing colors,etc. All of my coding experience is only in Swift, so I’m looking for assistance in Swift code functions that will help me accomplish this.

Any help on how to put together the logic to pull that data form Game Center and then have my estimate beacon display it, would be a GREAT help!

PS - I’m on a bit of a time crunch… so I sure could use some timely help in assistance and direction.

Have you tried going through the Game Center Programming Guide? I have to be honest, never done anything with Game Center, but it looks like a comprehensive guide to everything you’d need:

  1. Hooking up Game Center with your app: Incorporating Game Center into Your Game
  2. Authenticating a Local Player on the Device. After you authenticate the GKLocalPlayer should have a displayName property for you to read.
  3. Loading Information About Your Game’s Leaderboards
  4. Reporting Scores to Game Center
  5. Retrieving Score Data

If you have some specific questions, a particular code snippet from the above is not working or something, you could also try Stack Overflow – greater chance you’ll find some Game Center pro there.

These were GREAT sources, and I think I’ve got a solution for getting the game player identity that I need. The last piece I could really use some help on is finding some example code that shows how to get a beacon to display an advertisement of OTHER beacons that are around it. Again, you’ve been a great help!

Not sure I understand this right. Beacons themselves are (for the most part) broadcasters-only, they can’t receive messages or detect other beacons around them.