2

I am currently trying to make use of xcconfig files for the first time, in order to make working with provisioning profiles in my project easier. I'm building out Development.xcconfig, Beta.xcconfig, and AppStore.xcconfig.

Context:

I need to be able to build my app from the command line.

My app also has a Today extension with a different app ID and provisioning profile. So, I need to find a way to specify both provisioning profiles.

xcconfig files allow for setting the global provisioning profiles in the project, which is great.

However, they don't easily allow for setting the provisioning profile in target dependencies (i.e., the extension).

I'd like to avoid pointing a special flag in the extension's build settings (such as $(MY_EXTENSION_PROVISIONING_PROFILE)), as this will be overridden any time someone edits the extension's provisioning profiles. (so, the solution here will not suffice)

How can I contain all of these settings in an xcconfig file? If that's not possible, what would be an alternate solution to specifying these provisioning profiles outside of the project?

1 Answers1

0

You can absolutely set the provisioning profile, or any other build setting, for an app extension with an .xcconfig file. You just need to create separate .xcconfig files for your app extension.

Create separate .xcconfig files for your app extension, one for each of your Development, Beta and App Store configurations. Define the extension app ID and provisioning profile in there:

PROVISIONING_PROFILE_SPECIFIER = your profile specifier

PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.TodayExtension

PRODUCT_NAME = Today Extension

Then, in your Project settings, set the .xcconfig files that correspond with each scheme. Example shown here is my app - DevAppNew is an app target, and NotificationService is an app extension target. You would similarly have a separate target for your Today extension:

Project configurations

At build time on the command line, specify the scheme you wish to build and it will use the .xcconfig files you configured:

xcodebuild -workspace YourApp.xcworkspace -scheme Testing
shocking
  • 848
  • 12
  • 16
  • 2
    If you, like me, have no idea what shocking is talking about, there is an article about how to set this up: https://www.appcoda.com/xcconfig-guide/ – Rickard Elimää Sep 17 '19 at 08:44