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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:13:34+00:00 2026-05-25T14:13:34+00:00

I know that the application version in a Mac application is defined by the

  • 0

I know that the application version in a Mac application is defined by the Info.plist file situated inside the bundle.

The application version number in my case is not only informative, it defines some behaviors in my app. If someone edits this file, my application could break. The fastest solution is to compile the app version inside the executable.

Is there a common pattern for compiling the app version inside the executable?

The application version should be static/global IMHO.

  • 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-25T14:13:34+00:00Added an answer on May 25, 2026 at 2:13 pm

    In your target’s build settings, go to the Versioning category and change Versioning System from None to Apple Generic. Then, whenever you change the version of your application, change the Current Project Version setting. If you don’t change the other build settings, then each build will generate a file called $(PRODUCT_NAME)_vers.c which contains two variables, defined as follows:

    const unsigned char $(PRODUCT_NAME)VersionString[] = "@(#)PROGRAM:$(PRODUCT_NAME) PROJECT:$(PROJECT_NAME)-$(CURRENT_PROJECT_VERSION)\n";
    const double $(PRODUCT_NAME)VersionNumber = (double)$(CURRENT_PROJECT_VERSION);
    

    For the version number, anything after the second decimal place is cut off so that it can be represented as a double. i.e., 1.2.3 is stored as 1.2. Both variables are also given the used attribute so that they won’t be removed if you don’t use them.

    In order to use these variables, you need to declare them as extern in the files where they will be used. You can either do this in every file which will use them, or create a header with these declarations and include that in your files. The declarations should look like this:

    extern const unsigned char $(PRODUCT_NAME)VersionString[];
    extern const double $(PRODUCT_NAME)VersionNumber;
    

    Then you can use them like normal variables.

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

Sidebar

Related Questions

We all know that modifying a .NET web application's web.config file restarts the app
We know that a single application instance can use multiple cores and even multiple
I know that |DataDirectory| will resolve to App_Data in an ASP.NET application but is
Now that I know C++ I want to get into desktop application that have
I know that we shouldn't being using the registry to store Application Data anymore,
We have an application that needs to know the path that it is executed
I'd like to know how one would create an application that starts in the
I am interested to know whether anyone has written an application that takes advantage
Does anyone know of an application (hosted or otherwise) that I could use to
I have an application that sits in the status bar on the Mac. It

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.