Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8856971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:28:51+00:00 2026-06-14T14:28:51+00:00

I am using this library to report scores and achievements in my app: https://github.com/csddavies/DDGameKitHelper

  • 0

I am using this library to report scores and achievements in my app: https://github.com/csddavies/DDGameKitHelper

So in my app I report percentages to let the user know how close they are to completing an achievement. So I do something like this:

[[DDGameKitHelper sharedGameKitHelper] reportAchievement:@"Achievement1" percentComplete:totalTime/300.0f];

However it seems to be reporting that I completed the achievement, “Achievement1”, even though I didn’t. When I NSLog totalTime/300.0f I get a value like 0.563 and NOT 100.

So now I am thinking something must be wrong with the reportAchievement method, so I looked at it and I am not sure what could be wrong. Here are the methods related to reportAchievement:

-(void) reportAchievement:(NSString*)identifier percentComplete:(float)percent
{
    if (isGameCenterAvailable == NO)
        return;

    GKAchievement* achievement = [self getAchievement:identifier];
    if (achievement.percentComplete < percent)
    {
        NSLog(@"new achievement %@ reported", achievement.identifier);
        achievement.percentComplete = percent;
        [achievement reportAchievementWithCompletionHandler:^(NSError* error)
         {
             [delegate onReportAchievement:(GKAchievement*)achievement];
         }];

        [self saveAchievements];
    }
}

-(GKAchievement*) getAchievement:(NSString*)identifier
{
    GKAchievement* achievement = [achievements objectForKey:identifier];

    if (achievement == nil)
    {
        achievement = [[[GKAchievement alloc] initWithIdentifier:identifier] autorelease];
        [achievements setObject:achievement forKey:achievement.identifier];
    }

    return achievement;
}

So is there anything here that could cause my achievements to be reported as completed early even though they are really not?

Thanks!

Edit1:

2012-11-19 20:50:15.946 App[16894:907] percent: 0.005556
2012-11-19 20:50:15.947 App[16894:907] achievement percentComplete: 0.004861
2012-11-19 20:50:15.972 App[16894:907] percent: 0.000000
2012-11-19 20:50:15.973 App[16894:907] achievement percentComplete: 0.000000
2012-11-19 20:50:15.974 App[16894:907] percent: 0.026000
2012-11-19 20:50:15.974 App[16894:907] achievement percentComplete: 0.024000
2012-11-19 20:50:16.003 App[16894:907] percent: 0.002600
2012-11-19 20:50:16.004 App[16894:907] achievement percentComplete: 0.002400
2012-11-19 20:50:16.010 App[16894:907] percent: 0.000000
2012-11-19 20:50:16.011 App[16894:907] achievement percentComplete: 0.000000
2012-11-19 20:50:16.012 App[16894:907] percent: 0.016667
2012-11-19 20:50:16.012 App[16894:907] achievement percentComplete: 0.016667
2012-11-19 20:50:16.013 App[16894:907] percent: 0.000000
2012-11-19 20:50:16.014 App[16894:907] achievement percentComplete: 0.000000
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:28:53+00:00Added an answer on June 14, 2026 at 2:28 pm

    I believe the issue here is that in the check if (achievement.percentComplete < percent) it just is too vague. My percentComplete could be 5% and my percent value could be 6% but in no means is that 100% finished. So with the way the method is above it will just show the achievement banner every time the percentComplete on the achievement is updated which is not the way Game Center should work. I also noticed that even though the banner showed as if I did unlock the achievement, I really didn’t when I checked in the Game Center app. So the following method is what I did instead:

    -(void) reportAchievement:(NSString*)identifier percentComplete:(float)percent
    {
        if (isGameCenterAvailable == NO)
            return;
    
        GKAchievement* achievement = [self getAchievement:identifier];
        if (percent > achievement.percentComplete)
        {
            NSLog(@"new achievement %@ reported", achievement.identifier);
            achievement.percentComplete = percent;
            [achievement reportAchievementWithCompletionHandler:^(NSError* error) {
                 if (achievement.isCompleted) {
                    [delegate onReportAchievement:(GKAchievement*)achievement];
                 }
             }];
    
            [self saveAchievements];
        }
    }
    

    In this code it will still report the updated value towards the 100% but it will only show a banner if the isComplete BOOL from GC is returned YES.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the framework GKAchievementNotification (https://github.com/typeoneerror/GKAchievementNotification) in my iOS 4.1+ app. This app
Im using this library to parse CSV files in my GWT app. However, It
I'm using this java script library to show ratings http://www.fyneworks.com/jquery/star-rating/#tab-Overview . I'm using below
Using this page, http://developer.android.com/sdk/compatibility-library.html , I have installed the Android Support Package, added a
I'm using something similar to example C on this MSDN page: http://msdn.microsoft.com/en-us/library/ms190307.aspx DECLARE @tableHTML
I created this class library(ReportLib) with a simple Telerik report using Telerik Reporting Wizard.
I have enabled google Minify in code igniter using this library on our website.
We are using a third part library to render 3d. In this library there
I am using the hector HOM library to access my cassandra datastore. This library
I'm using a open-source Python library in my project. This library logs a lot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.