roddi/ValidateStoreReceipt — Issue #19: Alternative to statically defining ID and version (while still statically defining them)
Author: urkle
Created: 2012-02-10 15:47:06+00:00
State: open

Using some Macro magic we can do this.

```c
#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.