PlayerIO

The fastest way to build online games without breaking a sweat.

Objective-C Client Reference

Multiplayer  class documentationClass PIOAchievements

Language: Objective-C

The Player.IO Achievements service

Properties

 
myAchievements
The list of all achievements; the values of Progress and ProgressGoal will indicate whether the achievement is started/pending/complete.
onComplete
Callback block called whenever an achievement is completed by a call to progressXXX.

Methods

 
- (PIOAchievement*)
getWithAchievementId:
This method gets the specified achievement.
- (void)
loadWithuserIds:successBlock:
Load achievements for the specified users.
- (void)
loadWithuserIds:successBlock:errorBlock:
Load achievements for the specified users asynchronously.
- (void)
progressAddWithAchievementId:progressDelta:successBlock:
Add or subtract from the current progress of an achievement synchronously.
- (void)
progressAddWithAchievementId:progressDelta:successBlock:errorBlock:
Add or subtract from the current progress of an achievement asynchronously.
- (void)
progressCompleteWithAchievementId:successBlock:
Complete the specified achievement, by setting the progress to the maximum (ProgressGoal) of the achievement synchronously.
- (void)
progressCompleteWithAchievementId:successBlock:errorBlock:
Complete the specified achievement, by setting the progress to the maximum (ProgressGoal) of the achievement asynchronously.
- (void)
progressMaxWithAchievementId:progress:successBlock:
Sets the current progress value to the bigger value of progress or the current value synchronously, i.e; newProgress = Max(currentProgress,progress)
- (void)
progressMaxWithAchievementId:progress:successBlock:errorBlock:
Sets the current progress value to the bigger value of progress or the current value asynchronously, i.e; newProgress = Max(currentProgress,progress)
- (void)
progressSetWithAchievementId:progress:successBlock:
Sets the progress of the specified achievement synchronously.
- (void)
progressSetWithAchievementId:progress:successBlock:errorBlock:
Sets the progress of the specified achievement asynchronously.
- (void)
refreshWithSuccessBlock:
Refreshes myAchievements synchronously Refreshes myAchievements asynchronously.
- (void)
refreshWithSuccessBlock:errorBlock:
Refreshes myAchievements asynchronously.

@property (nonatomic) NSArray * myAchievements

The list of all achievements; the values of Progress and ProgressGoal will indicate whether the achievement is started/pending/complete.

@property (nonatomic) OnComplete onComplete

Callback block called whenever an achievement is completed by a call to progressXXX.

getWithAchievementId:

This method gets the specified achievement.

Arguments

NSString* achievementId
The id of the achievement to get

Return Value

PIOAchievement* The achievement, if found, otherwise nil

loadWithuserIds:successBlock:

Load achievements for the specified users.

Arguments

NSArray* userIds
Array of userIds to load achievements for.
void(^)(NSDictionary*) successBlock
Callback block that will be called with a dictionary where the keys are userIds and the values are their achievements.

loadWithuserIds:successBlock:errorBlock:

Load achievements for the specified users asynchronously.

Arguments

NSArray* userIds
Array of userIds to load achievements for.
void(^)(NSDictionary*) successBlock
Callback block that will be called with a dictionary where the keys are userIds and the values are their achievements.
void(^)(PIOError*) errorBlock
Callback block that will be called instead of successBlock if an error occurs.

progressAddWithAchievementId:progressDelta:successBlock:

Add or subtract from the current progress of an achievement synchronously.

Arguments

NSString* achievementId
The id of the achievement to add progress to.
int progressDelta
The delta value that will be added to the current progress of the achievement.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.

progressAddWithAchievementId:progressDelta:successBlock:errorBlock:

Add or subtract from the current progress of an achievement asynchronously.

Arguments

NSString* achievementId
The id of the achievement to add progress to.
int progressDelta
The delta value that will be added to the current progress of the achievement.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.
void(^)(PIOError*) errorBlock
Callback block that will be called instead of successBlock if an error occurs.

progressCompleteWithAchievementId:successBlock:

Complete the specified achievement, by setting the progress to the maximum (ProgressGoal) of the achievement synchronously.

Arguments

NSString* achievementId
The id of the achivement to complete.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.

progressCompleteWithAchievementId:successBlock:errorBlock:

Complete the specified achievement, by setting the progress to the maximum (ProgressGoal) of the achievement asynchronously.

Arguments

NSString* achievementId
The id of the achivement to complete.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.
void(^)(PIOError*) errorBlock
Callback block that will be called instead of successBlock if an error occurs.

progressMaxWithAchievementId:progress:successBlock:

Sets the current progress value to the bigger value of progress or the current value synchronously, i.e; newProgress = Max(currentProgress,progress)

Arguments

NSString* achievementId
The id of the achivement to work on.
int progress
The possible new progress value that should be compared to the current progress value.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.

progressMaxWithAchievementId:progress:successBlock:errorBlock:

Sets the current progress value to the bigger value of progress or the current value asynchronously, i.e; newProgress = Max(currentProgress,progress)

Arguments

NSString* achievementId
The id of the achivement to work on.
int progress
The possible new progress value that should be compared to the current progress value.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.
void(^)(PIOError*) errorBlock
Callback block that will be called instead of successBlock if an error occurs.

progressSetWithAchievementId:progress:successBlock:

Sets the progress of the specified achievement synchronously.

Arguments

NSString* achievementId
The id of the achivement to add progress to.
int progress
The new progress value for the achievement.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.

progressSetWithAchievementId:progress:successBlock:errorBlock:

Sets the progress of the specified achievement asynchronously.

Arguments

NSString* achievementId
The id of the achivement to add progress to.
int progress
The new progress value for the achievement.
void(^)(PIOAchievement*) successBlock
Callback block that will be called with the updated Achievement.
void(^)(PIOError*) errorBlock
Callback block that will be called instead of successBlock if an error occurs.

refreshWithSuccessBlock:

Refreshes myAchievements synchronously Refreshes myAchievements asynchronously.

Arguments

void(^)() successBlock
Callback block that will be called when the refresh is complete.

refreshWithSuccessBlock:errorBlock:

Refreshes myAchievements asynchronously.

Arguments

void(^)() successBlock
Callback block that will be called when the refresh is complete.
void(^)(PIOError*) errorBlock
Callback block that will be called instead of successBlock if an error occurs