Okay well I finally got it to work in the Xcode Simulator only (not on a device), but that is okay for testing to make sure it is working. Here is what I did…
iTunes Connect
(1) In iTunes Connect setup a Test User by going to Users and Roles > Sandbox Testers tab > Add (little round + sign).
(2) In iTunes Connect create your app and setup/add Leaderboard under the apps Game Center tab.
(3) In iTunes Connect on your apps main page, make sure you slide the Game Center slider to ON and then click the little round blue plus sign and add the Leaderboard you just created and then click SAVE.
UNITY
(4) In Unity at the top of your main script add:
using UnityEngine.SocialPlatforms;
(5) In this same script in void Start()
add:
Social.localUser.Authenticate ( success => { if (success) { Debug.Log("==iOS GC authenticate OK"); } else { Debug.Log("==iOS GC authenticate Failed"); } } );
(6) In this same script you can report the score from your game over method (or from wherever you want) with something like this:
int score = 50; //This is just a test value. You would probably pass score into this method.
string iOS_LeaderboardID = "com.me.myself.Leaderboard"; //Same as Leaderboard ID you setup in iTunes Connect.
bool isGCAuthenticated = Social.localUser.authenticated;
if (isGCAuthenticated) {
Social.ReportScore(score, iOS_LeaderboardID, success => { if (success) { Debug.Log("==iOS GC report score ok: "+score+"\n"); } else { Debug.Log("==iOS GC report score Failed: "+iOS_LeaderboardID+"\n"); } } );
} else {
Debug.Log("==iOS GC can't report score, not authenticated\n");
}
(7) In the Player Settings make sure you have iOS platform selected and then in the
Player Settings > Other Settings > Optimization > SDK Version > set it to Simulator SDK.
(8) Not sure if the following step is required, but in Player Settings I also have the following set:
Other Settings > Identification > Bundle Identifier > set to match the Bundle ID used in iTunes Connect.
Other Settings > Configuration > Scripting Backend > set it to IL2CPP
(9) BUILD to create Xcode project.
XCODE
(10) Open your project in Xcode and select the Build Settings tab and go to Code Signing > Code Signing Identity and choose the iPhone Distribution that corresponds to the same user/company of your iTunes Connect account where you created the app.
(11) Select the simulator test device you want to use and press Play button.
(12) App should start playing and the Game Center login should pop up. Login using the Test User you created in the Sandbox Testers in iTunes Connect.
(13) Play your game until the game over portion where it will report the score.
(14) From the Simulator drop down menus choose the Hardware > Home.
(15) Find the Game Center app icon, click it and you should be able to see the score you reported from your app.