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 5999107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:30:18+00:00 2026-05-23T00:30:18+00:00

How can I ensure my table data function is called only once when app

  • 0

How can I ensure my table data function is called only once when app is displayed again (from background start, or launch)?

That is, I want to have my table data refreshed when the user clicks on the application icon, and only once. So the requirement would be:
a) update method in controller called only once after application icon is clicked by user
b) to be valid irrespective of whether the user is (i) starting app for the first time, (ii) coming back from background, (iii) any other means of the user requesting the app come back to the foreground.

The issue I currently have with my implementation is that the data update is being called twice in the case where the app is coming back from background, so I basically want to improve on this. The way I’m doing currently, which is flawed is:

- (void)updateEventData {
    // UPDATE CODE HERE
}
- (void)becomeActive:(NSNotification *)notification {
    [self updateEventData];
    [self.tableView reloadData];
}

- (void)viewDidLoad {
    [super viewDidLoad];  
    [self updateEventData];

    // Auto Refresh Data - Handle Case where App becomes active from background & you want to refresh data
    [[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(becomeActive:)
                                                 name:UIApplicationDidBecomeActiveNotification
                                               object:nil];

}
  • 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-23T00:30:19+00:00Added an answer on May 23, 2026 at 12:30 am

    You can implement it in following way:

    1) Take one variable in NSUserDefault.
    2) Set it’s value FALSE when app is launch for the first time.
    3) Get the value of NSUserDefault variable in respective view controller. And if it’s value if FALSE then call update method.
    4) Now, when app become Active, then set the variable value TRUE.
    5) Get it’s value in respective view controller. And if’s value is TRUE then don’t call update method.
    6) So, update method will be called only once.

    Hope it will be helpful to you. May be there is some minor changes.

    Let me know in case of any difficulty.

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

Sidebar

Related Questions

Is there a best practice in getting data from multiple database tables using Zend?
Background I am developing a social web app for poets and writers, allowing them
In my database I have certain data that is important to the functioning of
What are the best practices for working with Sql server Xml columns to ensure
I have Created a Procedure for one of our .Net Devs where they can
I have a table of chalets where a chalet is referenced by an account...
Using the following table layout: TABLE Something ( SomethingId Name DateCreated IsObsolete ('Y','N') PRIMARY
When I insert a new record in the users table, first check email and
On occasion I get the following error when trying to synchronize from SQL Express
I have a database running on MS SQL Server 2005 and an ASP.NET 3.5

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.