An GKAchievement
object provides a standard user interface to display achievement progress for the local player. If the GKGame
class is available, you should use it instead.
SDKs
- iOS 4.1–7.0Deprecated
- macOS 10.8–10.10Deprecated
- Mac Catalyst 13.0–13.0Deprecated
Framework
- Game
Kit
Declaration
class GKAchievementViewController : GKGame Center View Controller
Overview
Important
Your game must authenticate a local player before you can use any Game Center classes. If there is no authenticated player, your game receives a GKError
error. For more information on authentication, see Game Center Programming Guide.
To show achievements for the local player, initialize a new GKAchievement
object and set the delegate. Then present the new view controller and wait for the delegate to be called. Once the delegate is called, dismiss the view controller.
On iOS, you present and dismiss the view controller from another view controller in your game, using the methods provided by the UIView
class. In macOS, you use the GKDialog
class to present and dismiss the view controller in a window.
Subclassing Notes
The GKAchievement
class is not intended to be subclassed.