I have two different app targets (a paid version and a free version) that use the same keyboard extension target. The only differences between the two app targets of concern to the keyboard are some string values that are currently defined with pre-processor macros. I need a way to ensure the string values the extension receives are the same as the values received by the source executable.
Is it possible for an extension to directly access information about the executable it is packaged with? I could probably manipulate the shared NSUserDefaults on first launch to store the string values for the keyboard but that seems roundabout and unsafe.
I was able to accomplish what I needed by checking the bundle identifier like so:
#define FOOFree [[[NSBundle mainBundle] bundleIdentifier] containsString:@"free"]
I then use the boolean result of the macro to set the values of the strings for the app and the extension as my extension's bundle identifier has a matching namespace to its source app (which should always be the case if convention is followed).