I need a way where you can view a leaderboard from an Apple Watch. I have seen Apple Watch Apps which do what I want to do. I know how to get the leaderboard and all that. But what I need help with is how do I authenticate Game Center on Apple Watch. Because Apples authentication Handler isn't compatible with watchOS. See here for more information on authenticateHandler.
I'm guessing I need to use background to fetch the authantication handler from the connected iPhone. But I don't have any experience in using background. So I wouldn't know how I go about doing that if that is the only solution?
Also, Using WatchConnectivity is another way. But again I don't know how to approach this. Any help would be nice!
Here is my authentication method for iOS:
But the authenticateHandler isn't available for watchOS.
I tried just using the isAuthenticated But that returned false because authenticate handler wasn't called.
I am open to solving this question anyway!
I'm guessing I need to use background to fetch the authantication handler from the connected iPhone. But I don't have any experience in using background. So I wouldn't know how I go about doing that if that is the only solution?
Also, Using WatchConnectivity is another way. But again I don't know how to approach this. Any help would be nice!
Here is my authentication method for iOS:
Code Block func authenticateLocalPlayer() { LocalPlayer.authenticateHandler = { [self] viewController, error in if ((viewController) != nil) { self.present(viewController!, animated: true, completion: { }) } let isGameCenterReady = (viewController == nil) && (error == nil) if isGameCenterReady { if LocalPlayer.isAuthenticated { //is Authenticated } else { //not } } } }
But the authenticateHandler isn't available for watchOS.
I tried just using the isAuthenticated But that returned false because authenticate handler wasn't called.
I am open to solving this question anyway!