Skip to content

Alternative to statically defining ID and version (while still statically defining them) #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
urkle opened this issue Feb 10, 2012 · 1 comment

Comments

@urkle
Copy link

urkle commented Feb 10, 2012

Using some Macro magic we can do this.

#define makeStr(s) makePStr(s)
#define makePStr(s) #s

#if !defined APP_BUNDLE_ID && !defined APP_BUNDLE_VERSION
#error  Define APP_BUNDLE_ID and APP_BUNDLE_VERSION
#endif

NSString * const bundleVersion = @makeStr(APP_BUNDLE_VERSION);
NSString * const bundleIdentifier = @makeStr(APP_BUNDLE_ID);

This will still statically define them, YET allow them to be "updated" with the via macro defines. So simply adding

APP_BUNDLE_ID=com.example.${PRODUCT_NAME}
APP_BUNDLE_VERSION=${APP_VERSION}
(assuming you also have a ${APP_VERSION} variable defined) to the xcode preprocessor settings will allow central management of the bundle ID and version for receipt validation as well as Info.plist generation.

@ItalyPaleAle
Copy link

+1 for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants