When you are working on an iOS app project file and plan to distribute it as open source or sample code, you may not want to set code signing settings in the project file. However, while working locally, you need to set the code signing settings, otherwise you will not be able to install it on the device.
In such cases, it is useful to use a build configuration file for code-signing settings.
Create the build configuration file
For more information about how to create the build configuration file, please see the following article.
Using the above article as a guide, create the following three build configuration files.
Debug.xcconfig to debug build and
Release.xcconfig to release build.
Write the following in
Release.xcconfig to include
Configure the code signing
In Xcode, code signing is set up in following places.
Signing & Capabilitiestab of each build targets.
Signing & Capabilities tab
The Signing & Capabilities tab for each target sets target-specific code signing settings. The values set in this tab are also set in the Signing of the target’s Build Settings.
The configuration items are grouped under Signing.
|Automatically manage signing||Whether the signing settings is managed by Xcode or not.|
|Team||The developer team|
|Bundle Identifier||The bundler identifier of target|
|Provisioning Profile||The provisioning profile of target|
|Signing Certificate||The code signing certificate|
Build Settings tab
Signing of the
Build Settings tab contains code signing related settings, and the
Signing & Capabilities and the
Build Settings tabs are synchronized.
Signing & Capabilities tab is synchronized with the
Build Settings tab.
Signing & Capabilities tab is not available in the project settings but
Build Settings tab is also available in the project settings.
We usually configure it in the
Build Settings tab in the project tab but not in the target settings. Because the all targets in the project uses same code signing settings.
The settings related to the code signing are following.
|Code Signing Identity||The code signing certificate|
|Code Signing Style||Whether the settings are managed by Xcode or not|
|Development Team||The developer team|
|Provisioning Profile||The provisioning profile|
Clear the signing settings of the project file
Before changing code signing settings in the build settings file, clear the values set in the project file. Xcode will give priority to the project file settings if they are written in both the project file and the build settings file.
Do as follows.
Code Signing Identity
Code Signing Style
Items in bold are items that have been changed from the inherited values or the default values, and the settings are cleared by using the Delete key.
Edit the build settings file
Signing.xcconfig to configure code signing. There are four items to configure.
CODE_SIGN_STYLE specifis that whether the Xcode manage the code signing settings or not. The following values are defined.
|Turn on |
|Turn off |
DEVELOPMENT_TEAM specifis the development team. The value is a team ID. The team ID is displayed at
TEAM ID in
Membership Details page in the Apple Developer web site.
CODE_SIGN_IDENTITY specifies the code signing certificate to sign. The value is a certificate name which is displayed in Xcode. For example,
Automatic setting is
Apple Development. Specify the the name is containing the team ID like
Developer ID Application: Akira Hayashi (XXXXXXXX) in the keychain. Replace the
(XXXXXXXX) with your team ID.
PROVISIONING_PROFILE_SPECIFIER specify the provisioning profile file. The value is name or UUID.
Example of the sample configuration settings file
The following code is a sample of
CODE_SIGN_STYLE = Automatic DEVELOPMENT_TEAM = ABCDEFGHIJ CODE_SIGN_IDENTITY = Apple Development PROVISIONING_PROFILE_SPECIFIER = ExampleProfile
Remove from git management
Signing.xcconfig is used for not containing the code signing settings in the project file will be deployed, so remove the
Signing.xcconfig from the git magement. To avoid build failer when the
Signing.xcconfig is missing, use
#include? statement to include it in the