Xcode will archive but Xojo fails with "A distribution profile is required when building for the app store."


I’ve checked previous posts and couldn’t find anything to help.

When I Build for App Store (to upload to TestFlight), I get the following error:

A distribution profile is required when building for the app store.

If I Archive a simple app in Xcode, it seems to do everything OK (It archives and offers the option to “Distribute App”.

Does anyone have a resource to point me towards to remedy this?

I’m expecting I will need to clear out my KeyChain certs and start from scratch, but I’m nervous I will lose the ability to distribute Mac apps in the process.

Thanks for any help

You shouldn’t have to touch Keychain.

It’s clearly something to do with the distribution profile. When you’re coding and testing you need a Development profile, but later you need a distribution profile to upload it to the App Store. Not sure what the requirements are for TestFlight as I’ve never used that.

Go look at your distribution profile online and make sure it is correct. Download a copy. Double-click it to launch Xcode and make it available.

Thanks very much Art. Yes, I have the distribution profile and I think the proof it’s okay is the Archive is available in Xcode and it looked like it would allowed me to upload to the App Store.

I wonder is there any utility available (a bit like Sam’s App Wrapper for macOS) which would test and highlight issues? When I look in Xcode Preferences I see not in keychain for some of the Signing Certificates and are greyed out. One of the (many) things I find confusing is the Apple Developers web site lists all the Certificates with the same name so (for me) there’s no way to see which cert is designed for which computer (We have 3 and I’m sure that’s adding to our problems)

When the KeyChain has a Valid “iPhone Distribution” Cert and I am able to build Apps for Development, does anyone know why I would get the error “A distribution profile is required when building for the app store.” when trying to build for the App Store (well actually for TestFlight for now)

On this page of the developer website:

do you have BOTH development and App Store profiles created?

Jeff. Thank you very much and I think this may be my problem! I have tried to install the iOS Distribution Profile in Xcode and get the following error:
**Failed to install one or more provisioning profiles on the device.** Please ensure the provisioning profile is configured for this device. If not, please try to generate a new profile.
I checked bundle identifiers everywhere I could see it referenced and they all match. When it mentions ‘Device’, is that the connected iPhone or the Mac? Thanks again for any help!

Apples hoops are pedantic and annoying

If you, the developer, own an iPad and an iPhone, you must register these devices in yoru developer account.
For each of these, for each of your apps, you need to request a provisioning profile to allow the device to accept the app.
Have you done that part?

Hi Jeff. I really appreciate you staying with me on this. Yes. I have my devices registered (I even attempted to re-register my iPhone and I couldn’t as it said it was already registered). If the device wasn’t recognised as a registered device, would I be unable to upload a developed app to it using Xcode (I am currently able to do this will all my devices)?

I wonder, if it deleted everything from the apple site and my keychain and started again would it be worth doing? (I’m nervous that I would end up not being able to release Mac apps by doing this).

Thanks again. Chris

This is the thing that scares the carp out of me every time the certificates go wrong.

if it deleted everything from the apple site and my keychain and started again would it be worth doing?

I’ve had to do that a few times… every 2 years or so.
Sadly, I can’t offer a magic bullet… each time it happens to me, I’m here asking the same questions as you. (look me up… :frowning: )
The error messages I get via Xojo when it won’t build are incomprehensible.

But let’s check a few things… I’ve shamelessly stolen some screenshots and info for the following info, to save me time logging in and out of stuff.
I hope it helps, but Im not claiming expertise.

Have you created an App ID for this app, with the correct name?

Make sure you have created and installed your Distribution Certificate and exported it as a .p12 file (for more information, see “iOS - Creating a Distribution Certificate and .p12 File.”)

Did you request an App Store provisioning profile , here?

Selecting the App ID for your app

After that, you will be asked for your certificate, and you can download your profile.

Thanks very much again Jeff :slight_smile:

I think “yes” is the answer to the questions you asked, but I’m going to double-check everything and look at your links. If I find a solution from your help or another source, I’ll update the thread.


I suggest that you look at my blog post from last year as I’d gone through and figured out what all the dependencies were:

1 Like

Thanks very much Greg. I hadn’t come across that in my searches so I’ll give it a bash!

  • Chris

That’s really good info Greg. It cleared up a lot for me. Especially the dependancy with the Application Identifier.

I have three questions, if you don’t mind answering:

  1. I think my best approach is to delete all my Certificates & Profiles from my Developer Account and remove any reference to Apple Developer & Distribution in my Keychains on the three Macs we have. Would you recommend not doing this?
  2. In my iOS Xojo Project, The team I have selected is called “Obatics Software”. Where is this information taken from (ie. when I remove everything in (1), will this also disappear?
  3. Once I go through your steps (and assuming everything goes okay!), will my Xojo project have any problems associating with the new setup.

Thanks again for any help!


Leave your App identifiers and devices alone.

If you’re wary about deleting things, I would start by looking at the certs and profiles life your development chain and just checking to make sure they’re exactly right. That is, the dates and names on the certs match the ones that are in your keychain and that the profile is for the app identifier, devices and your dev cert.

Oh, and make sure you’re not trying to use a wildcard cert. I was never able to narrow it down, but Xojo does not handle them well for some reason.

Once dev is done, move on to the distribution chain and check that the profile contains all the right things too.

If things still don’t work right, delete the iOS profiles and then go to Xcode and manually sync with your account. Don’t bother deleting any certs if they’re not expired.

The team comes from the dev and dist profiles you have and reflects the company you were logged into when you created the profile.

You shouldn’t. The info I laid out there is the process I used to help users whenever they called.

Here’s an project that I threw together tonight that’ll list your installed profiles, let you remove the ones that are expired or no longer needed, or just reveal them in the Finder.

Profile Lister

I find that I have to clean these up periodically because Xcode doesn’t do it automatically and because duplicates seem to be the source of a lot of problems with profiles. Make sure you only have one distribution and one development profile for each app identifier.

if you get an exception in RefreshList, just click resume.

Wow! Thanks for all your answers Greg and for going to such trouble creating the Project, which I can see will be something I’ll be using a lot!

I ran your project and it actually says
iOS Team Provisioning Profile: *
So it has a wildcard set for that, the rest are
Do you think this needs to be changed (and if so, how do I go about this?)

Thanks again, Chris

I’ll contact you privately so you don’t have to expose your info publicly.

I’ve updated the app that I had linked to above with a binary:

Profile Lister

this one adds some highlights to make it easier to discern dev from dist profiles, added a column to see if the profiles were created in xcode and adds a red highlight for wildcard app IDs.

edit: …and it’s signed now.

1 Like