3
votes

I have a project with multiple targets. Each target has a user-defined build setting named $(BUNDLE_ID) to set the bundle ID of that target - of course this setting must be per-target, not for the whole project.

Now for the WatchKit Apps, I need to have multiple WatchKit targets (two for each iOS App target), and each of those uses $(PARENT_BUNDLE_ID) for convenience and ability to share Info.plist etc. between multiple targets.

Currently the $(PARENT_BUNDLE_ID) needs to be set twice (Once in the WatchKit App target and once in the WatchKit Extension target). What I would like to do is specify it zero times for the WatchKit components, and somehow inherit/copy it from the $(BUNDLE_ID) of the iOS App target in which it is embedded. Is this possible, and how can I set it up in Xcode?

1

1 Answers

2
votes

Yes, It can be done. In order to have a bundle identifier which can be accessible to all your target, you need to define that bundle identifier into project setting as user defined keys and assigned a value to it.

Once you define key "Bundle_ID" into project setting, the key "Bundle_ID" will reflect into all your target which are associated with that project setting.

Project Setting You can access these key using $(Bundle_ID) into plist for all your targets, as explain into image below.

Plist and target will reflect user defined value