Skip to content

Instantly share code, notes, and snippets.

@Majirefy
Created March 20, 2017 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Majirefy/eb65d99cb7e7dba7ae1eaf99f870ca53 to your computer and use it in GitHub Desktop.
Save Majirefy/eb65d99cb7e7dba7ae1eaf99f870ca53 to your computer and use it in GitHub Desktop.
GKLocalPlayer localPlayer = GKLocalPlayer.localPlayer();
localPlayer.setAuthenticateHandler(new GKLocalPlayer.Block_setAuthenticateHandler() {
@Override
public void call_setAuthenticateHandler(UIViewController viewController, NSError nsError) {
if (viewController != null) {
iosApplication.getUIWindow().rootViewController().showDetailViewControllerSender(viewController, null);
} else if (localPlayer.isAuthenticated()) {
localPlayer.generateIdentityVerificationSignatureWithCompletionHandler(
new GKLocalPlayer.Block_generateIdentityVerificationSignatureWithCompletionHandler() {
@Override
public void call_generateIdentityVerificationSignatureWithCompletionHandler(
NSURL publicKeyUrl, NSData signature, NSData salt, long timestamp, NSError error) {
//successfully logged into gamecenter
}
});
} else {
//canceled by the user or GameCenter is disabled
//display alert view
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment