0

I'm trying to build a continuous integration's script on my xcode project, but I'm stuck trying to archive my xcode project using xcodebuild command. When trying :

sudo xcodebuild -scheme MyScheme -archivePath builds/XXX.xcarchive archive DEVELOPMENT_TEAM=YYY CODE_SIGN_IDENTITY='iPhone Distribution' CODE_SIGN_STYLE='Manual' PROVISIONING_PROFILE_SPECIFIER=ZZZ
  • XXX is my project name

  • YYY is my development team identifier, like ABC123DEF, it's a string

  • ZZZ is my provisionning profile name, not a code but a string, like "My Provisionning Profile"

I always get this error :

error: No profile for team 'YYY' matching 'ZZZ' found: Xcode couldn't find any provisioning profiles matching 'YYY/ZZZ'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor. 

However, when opening manually the XCode project and trying to archive, it works perfectly.

What am I missing? How can I get the full list of team/provisionning_profile installed on my Mac?

What I have tried so far :

  1. I tried to remove the part where I specify the development team and provisionning profile, leaving only the scheme identifier. Same result considering the scheme is defined with the same informations.

  2. I tried to go in my mobileprovision folder to check if the provisionning profile exists (it exists)

  3. I tried to display the xcode archive command lines in the editor (On the Report navigator tab). Actually it never shows the xcodebuild command directly but a bunch of subcommands. However I could find out that my XXX team identifier and YYY provisionning profile that I am using are using in this script

Does anyone know how I can solve this issue?

0

2 Answers 2

2

I finally found the problem, it came from the sudo before xcodebuild.

The sudo command will run the following action under the root user by default, which doesn't have any provisioning profile installed, as I always registered them under my user profile.

here is what I did :

sudo -u myuser xcodebuild -scheme MyScheme -archivePath builds/XXX.xcarchive archive DEVELOPMENT_TEAM=YYY CODE_SIGN_IDENTITY='iPhone Distribution' CODE_SIGN_STYLE='Manual' PROVISIONING_PROFILE_SPECIFIER=ZZZ

and the error disappeared. Hope this can help someone.

Sign up to request clarification or add additional context in comments.

3 Comments

the sudo -u myuser part allow me to run the following command under myuser instead of jenkins
Ah. Thanks. Little weird to have the jenkins user able to execute commands as root but reading online it seems people do this pretty commonly. Not sure why people wouldn't use su instead. Glad you figured it out.
To be fare, I recklessly installed jenkins on my OSX, I think if I did it correctly I wouldn't have had to add sudo everywhere. If you are interested in a correct installation of jenkins user on OSX, here a link which explains how to achieve it medium.com/@ved.pandey/…
0

Provisioning profiles are in ~/Library/MobileDevice/Provisioning Profiles/

You could add -allowProvisioningUpdates to allow xcodebuild to "solve" the problem itself, but... ¯_(ツ)_/¯ for how safe/good the result will be. You've specified "manual" so I assume you don't want to do this.

I suspect you are trying to archive the project but only have a development profile installed. Build a Release build of the project from within Xcode and that should get it to download a release (distribution) provisioning profile for you which you can then use from the command line.

2 Comments

No this is a Release provisioning. I suspect the issue comes from the provisionning: My client sent it to me and I don't have access its the apple developer account. Actually it works when archiving from XCode, but not in xcodebuild command line.
You can open the archived app package and look at the provisioning profile there to see which one it used. (it's renamed but you can figure it out). The provisioning profile quicklook generator is very helpful for this stuff. If Apple isn't providing one yet (sigh), there's this one which works well: github.com/chockenberry/Provisioning

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.