Xcode 9中xcconfig配置PROVISIONING_PROFILE_SPECIFIER失效问题咨询
Xcode 9: PROVISIONING_PROFILE_SPECIFIER in xcconfig vs exportOptionsPlist
Great question—this is a common gotcha when moving to Xcode 9 and later, so let’s break this down clearly:
1. It’s not that xcconfig is useless, but behavior differs between build/archive and export stages
- Build/Archive phase: Your existing xcconfig setup with
PROVISIONING_PROFILE_SPECIFIERstill works perfectly. Xcode will respect the value set in your Scheme-linked xcconfig file when compiling and creating the archive. This means you can keep using xcconfig to isolate signing configurations per Scheme (e.g., dev vs staging vs production) as you did before. - Export Archive phase: This is where the change happens. Starting in Xcode 9, when you run
xcodebuild -exportArchive, the tool prioritizes theprovisioningProfileskey in yourexportOptionsPlistover any signing settings from the xcconfig. This is because the export phase focuses on preparing the build for distribution (Ad Hoc, App Store, Enterprise, etc.), which often requires a different provisioning profile than the one used for archiving.
2. How to use both tools effectively
You don’t have to abandon xcconfig—instead, combine it with exportOptionsPlist for a clean workflow:
- Keep using xcconfig for build-time signing: Maintain your Scheme-specific xcconfig files to set
PROVISIONING_PROFILE_SPECIFIER,CODE_SIGN_IDENTITY, and other build-related signing flags. This keeps your environment configurations organized and separated. - Use exportOptionsPlist for distribution signing: Create separate plist files for each distribution type (e.g.,
ExportOptions-AppStore.plist,ExportOptions-AdHoc.plist). In each, define theprovisioningProfilesdictionary to map your bundle ID to the correct distribution provisioning profile:
Alternatively, if you use Apple’s automatic signing, set<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>method</key> <string>app-store</string> <key>provisioningProfiles</key> <dict> <key>com.yourcompany.yourapp</key> <string>Your App Store Provisioning Profile Name</string> </dict> </dict> </plist>signingStyletoautomaticin the export plist—Xcode will handle matching the correct provisioning profile for you without needing to specifyprovisioningProfiles.
3. Why you might think xcconfig "stopped working"
The confusion usually comes when you export an archive and see signing issues. The archive itself was signed correctly using your xcconfig settings, but the export process overrides those settings to apply the distribution-specific profile. So it’s not that the xcconfig is broken—it’s just that the export phase has its own priority for signing configuration.
内容的提问来源于stack exchange,提问作者sanjayp
相关产品推荐
相关产品推荐

