0

In Cocoa you can use NSBundle to obtain the current bundle version number in your code, see for example this question.

How can you do the same thing at compile time? For example, if you want to make a compile time assertion based on the bundle version.

Maybe there is a predefined macro for that?

Community
  • 1
  • 1
Emerald Weapon
  • 2,392
  • 18
  • 29
  • assertion to do what ? – Wain Mar 31 '15 at 13:32
  • Something weird, I have to admit... some dirty work around that I may or may not consider doing and that has to do with a very odd cross-platform portability issue. I won't go into details, but I would be interested to know if this should be generally possible. – Emerald Weapon Mar 31 '15 at 15:41

1 Answers1

1

You cannot directly have a macro that will expand to values from Info.plist. What you can do is the other way around: add a predefined setting that holds the bundle version, and reference it in Info.plist; you'll also have it available in your code.

Cristik
  • 30,989
  • 25
  • 91
  • 127