Class: GKAchievementDescription

Inherits:
NSObject show all

Overview

An GKAchievementDescription object holds text and images used to describe an achievement. When you develop your game, you create localized achievement descriptions in iTunes Connect. At runtime, your game retrieves these descriptions from Game Center. Usually your game downloads the achievement descriptions when it wants to present a custom achievement user interface to the player.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (String) achievedDescription (readonly)

A localized description to be used after the local player has completed the achievement. (read-only)

Returns:

- (String) groupIdentifier (readonly)

The identifier for the group the achievement description is part of. (read-only) If your game is configured to be part of a game group in iTunes Connect, this property holds the identifier you assigned to the achievement in the game group. If the game is not part of a game group, this property is nil.

Returns:

- (Boolean) hidden (readonly)

A Boolean value that states whether this achievement is initially visible to players. (read-only) If the value of this property is NO, this achievement is always visible to the player. If YES, the achievement is not displayed in any of the standard achievement user interface screens. It remains hidden until the first time your game reports progress towards completing this achievement.

Returns:

  • (Boolean)

- (String) identifier (readonly)

A unique string used to identify the achievement. (read-only) The GKAchievementDescription property holds the identifier string you created for the achievement on iTunes Connect.

Returns:

- (UIImage) image (readonly)

An image to display for the completed achievement. (read-only) The value of this property is undefined until after the image is loaded. See loadImageWithCompletionHandler:.

Returns:

- (Integer) maximumPoints (readonly)

The number of points the player earns by completing this achievement. (read-only)

Returns:

- (Boolean) replayable (readonly)

A Boolean value that states whether this achievement can be earned multiple times. (read-only) If the value of this property is NO, then the achievement may only be earned once. After the achievement is earned, Game Center ignores any further progress submitted for it. If the value of this property is YES, then the achievement is considered earned each time your game reports progress to Game Center that completes the achievement. This means that any appropriate banners are displayed to the player again, challenges based on the achievement are completed, and so on.

Returns:

  • (Boolean)

- (String) title (readonly)

A localized title for the achievement. (read-only)

Returns:

- (String) unachievedDescription (readonly)

A localized description of the achievement to be used when the local player has not completed the achievement. (read-only)

Returns:

Class Method Details

+ (UIImage) incompleteAchievementImage

A common image for incomplete achievements. On OS X, this class method returns an NSImage object but otherwise works identically.

Returns:

+ (Object) loadAchievementDescriptionsWithCompletionHandler(completionHandler)

Downloads the achievement descriptions from Game Center. When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. Keep in mind that the completion handler may be called on a thread other than the one originally used to invoke the method. This means that the code in your block needs to be thread-safe.

Parameters:

  • completionHandler

    A block to be called when the download is completed.The block receives the following parameters:descriptionsAn array of description objects for the achievements in your game. If an error occurred, this value may be non-nil. In this case, the array holds whatever descriptions were downloaded by Game Kit before the error occurred.errorIf an error occurred, this error object describes the error. If the operation completed successfully, this value is nil.

  • descriptions

    An array of description objects for the achievements in your game. If an error occurred, this value may be non-nil. In this case, the array holds whatever descriptions were downloaded by Game Kit before the error occurred.

  • error

    If an error occurred, this error object describes the error. If the operation completed successfully, this value is nil.

Returns:

+ (UIImage) placeholderCompletedAchievementImage

A common image for completed achievements. When an achievement is completed, your game can display this image until the custom image for an achievement finishes loading.On OS X, this class method returns an NSImage object but otherwise works identically.

Returns:

Instance Method Details

- (Object) loadImageWithCompletionHandler(completionHandler)

Loads the image property for a completed achievement. Your game should call loadImageWithCompletionHandler: for each achievement the user has completed. Your game should display the placeholder image until the image is successfully downloaded. After the block is called, the description’s image property holds the same image object that is returned to the block.When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. Keep in mind that the completion handler may be called on a thread other than the one originally used to invoke the method. This means that the code in your block needs to be thread-safe.On OS X, this class method returns an NSImage object but otherwise works identically.

Parameters:

  • completionHandler

    A block to be called when the download is completed.The block receives the following parameters:imageThe downloaded image. If an error occurred, this value is nil.errorIf an error occurred, this error object describes the error. If the operation completed successfully, this value is nil.

  • image

    The downloaded image. If an error occurred, this value is nil.

  • error

    If an error occurred, this error object describes the error. If the operation completed successfully, this value is nil.

Returns: