xcodebuild flag overrides code signing for pods project targets

3.8k views Asked by At

I have a problem with building (archiving) the workspace because whenever I run

xcodebuild archive -workspace app.xcworkspace/ -scheme app-scheme -configuration Production -derivedDataPath ./build -archivePath ./build/Products/app.xcarchive DEVELOPMENT_TEAM=AAABBBCCCD PROVISIONING_PROFILE_SPECIFIER="prod DistProf" CODE_SIGN_IDENTITY="iPhone Distribution"

I get

XXX does not support provisioning profiles. XXX does not support provisioning profiles, but provisioning profile YYY has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor.

for each pod. When I omit the DEVELOPMENT_TEAM flag then I get

Signing for "myAPP" requires a development team. Select a development team in the build settings editor that matches the selected profile "YYY".

All the pods do not need signing. Specifying the flag in the command line seems to ignore the settings for different project. I can't use automatic signing as I am not a member of the team that issued the certificate, I only have cert and provisioning profile on my machine so any fastlane solutions won't work. Also I can't set it up once in the project as it comes from a 3rd party company and we can't share our profiles. How can I set up this project to continuous integration chain?

1

There are 1 answers

0
Juan Carlos Ospina Gonzalez On

I was having the same issue and found a working solution after much trial an error.

I couldn't get the command line approach to work, despite a claim to the contrary that i found on this Google group https://groups.google.com/forum/#!topic/cocoapods/q5x653je7MA

What worked for me was to stop specifying the team, provisioning and identity in the command line and instead move that to a xconfig file.

In the particular case of working with Cocoapods it goes like this:

Create the xconfig file. This is done by simply creating a new "Configuration Settings" file with Xcode (it's under 'Other' in the new file dialog). This file will be empty.

Fill in the values for code signing in the xconfig file. This can be done by first setting the values in xcode's build settings and then copy & pasting over. The resulting file looks something like this:

#include "Pods/Target Support Files/Pods-xxx/xxx.release.xcconfig"

//:configuration = Release
DEVELOPMENT_TEAM = xxx
//:configuration = Release
PROVISIONING_PROFILE_SPECIFIER = xxx/xxx

Replace xxx with the right values for your project. The PROVISIONING_PROFILE_SPECIFIER value is

a combination of the Team ID and profile name (as it is named in the Developer Portal, not necessarily the actual filename)

as specified here https://possiblemobile.com/2016/06/code-signing-xcode-8/

Note that the first line is to include the release.xconfig generated by cocoapods. This is important! if you don't do this and run pod update, you will see a warning pop up asking you to do it or else nothing will work

Assing your project to use the xconfig file. This is done by going to the Project's General tab and scrolling to the Configurations setting. You can then select your newly created xconfig file from the dropdown under Release

(further information on how to use a xconfig file can be found here http://www.jontolof.com/cocoa/using-xcconfig-files-for-you-xcode-project/)

With all that in place, you can proceed to build the archive:

xcodebuild archive \
             -workspace "xxx" \
             -scheme "xxx" \
             -sdk iphoneos \
             -archivePath "xxx"