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

  • SEARCH
  • Home
  • 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 6849861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:02:55+00:00 2026-05-27T01:02:55+00:00

i have a button in my app a button that submit score to gamecenter

  • 0

i have a button in my app a button that submit score to gamecenter and works.
this is the code:

-(void)subScore{
GKScore *scoreRepoter = [[[GKScore alloc] initWithCategory:@"123456"] autorelease];
scoreRepoter.value=100;
[scoreRepoter reportScoreWithCompletionHandler:^(NSError *error) {
  if (error!=nil) {
      NSLog(@"errr submitting");
   }else
       NSLog(@"ok!");
}];

now i’d like to submit score before app is closed with home button.
i thought to customize an action of home button (if it is possible)
or perhaps i make the same line of code in viewDidUload…or something like that…
will i be sure that that action will be performed before unloading the app?
i should make that code in dealloc method?
thanks

  • 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-05-27T01:02:56+00:00Added an answer on May 27, 2026 at 1:02 am

    You can’t customize behaviour of Home button directly, but iOS provides some methods in your application’s delegate, by which you can control lifecycle of the application.

    Method called right before the application goes to background is applicationWillResignActive: in your application’s delegate (usually this method is located in AppDelegate.m file).

    I think you can get needed effect by calling your method like that:

    - (void)applicationWillResignActive:(UIApplication *)application {
        [mygame subScore];
    }
    

    Also please note that iOS has time limit of execution for this method: you must do all saving-the-game work in less that five seconds or your application will be killed.

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

Sidebar

Related Questions

I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is
I have an asp.net app with an asp:button that causes a postback, this means
I'm now testing GKPeerPickerController. I have a simple app that just have a button
Hello StackOverflow'ers, I have a (flex) app that, on the click of a button,
I have a button that launches the google maps app on my device via
I have used this tutorial from Google to build a web app that finds
I have a small application that has several checkboxes, a submit button, and a
I have several buttons on my app that are being created dynamically. They are
I have a WPF app that is using the MVVM pattern. Hooking up buttons
In my app there is requirement that..I have 6 buttons in a nib, when

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.