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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:00:14+00:00 2026-05-22T20:00:14+00:00

What will be the best way to check that application is already installed or

  • 0

What will be the best way to check that application is already installed or being installed for the first time.

  • 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-22T20:00:15+00:00Added an answer on May 22, 2026 at 8:00 pm

    Bundle version and saving it in user defaults.

    EDIT:

    There are three things to note here.

    1. Bundle version: This is the version of the your application that you want to release.

    2. Old version: This will indicate previous version of your application. We will store this in user defaults so that we will know what was the old version when updating our application. This will obviously be nil if your bundle version is 1.0.

    3. Target version: This indicates the version the user is targeting. We will discuss this later.

    So, condition such as

    bundleVersion > oldVersion or

    if(isVersionBetter:myBundleVersion thanVersion:oldVersion)
    

    would either mean we want to create our database (in this case bundle version would be 1.0 and old version will be nil) or update our database (in this case bundle version would be something greater than 1.0 and hence old version would not be nil).

    Thus, as we can see, creation of database means user is installing app for the first time. Updating database means user has already installed the app and is updating the database.

    But, there might also be a case when you want to update your app and want to keep the database as it is. That is, only UI updating.

    Here, target version comes into picture.

    As mentioned above, target version is the version the user is targeting. All would work same as above if user is targeting the bundle version. But if user is targeting some other version than bundle version, we would skip database updating part, thus allowing only the UI to change.

    So, the final statement would be something like this:

    if( bundleVersion == targetVersion AND bundleVersion > oldVersion ) {
    // Either create or update the database.
    }else {
    // Do nothing. Skips database updating and allows UI update.
    }
    

    Thus, your database function would look something like this

    -(void) initWithTargetVersion:(NSString *) targetVersion {
    
        NSString *oldDatabaseVersion = [[NSUserDefaults standardUserDefaults] stringForKey:@"OldDatabaseVersion"];
        NSString *bundleDatabaseVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
    
    
        if([bundleDatabaseVersion isEqualToString:targetVersion] && [self isVersionBetter:oldDatabaseVersion new:targetVersion]) {
            // Create or update the database.
        }else {
            // Do nothing.
        }
    }
    

    where user would pass the target version as follows:

    [[DatabaseManager sharedManager] initWithTargetVersion:@"1.0"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best way to write a function (or something DSLish) that will
Hello my WinForm application has a textbox that will be used for a time
I have an application that will initially be downloaded and installed by the user.
I got this question from my cousin: What will be the best way to
This will probably be obvious but I can't find the best way. I want
Hopefully this explanation will make sense, but what is the best way (if it
I would like to create a calculated member, (or whatever is best) that will
I wonder is it possible to write a console application that will surf to
Possible Duplicate: Best way to detect when user leaves a web page Check if
I'm developing an application that will be published via ClickOnce. I've been using the

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.