Skip to content

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

Description

@urkle

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions