Please don't dismiss this as a duplicate without reading fully - I've scoured the net and stackoverflow and found many questions like this, but none of the fixes work and I'm not sure why.

It doesn't help that the xcode configuration is still offline at the dev center, but I should still be able to do this manually.

I'm preparing an app for submission and the code signing of the Archive isn't working.

Provisioning profile 'Company Distribution' specifies the
Application Identifier 'Company.*' which doesn't match the current
setting '2Cxxxxx3D5.Company.App'

So the issue is that it thinks the provisioning profile doesn't have the prefix of my apple developer ID, and when you look at the code signing options under settings you'd be inclined to agree, it says "Company Distribution for Profile Bundles 'Company.*'"

However, in organiser the profile clearly says '2Cxxxxx3D5.Company.*'. The App ID is right in Organiser but for some reason is then wrong in the code signing dropbox.

So far I have

  1. Deleted all the profiles from my machine
  2. Deleted all the profiles from the ios center
  3. Cleaned the build, emptied the build directories
  4. Restarted my mac
  5. Restarted my iPad
  6. Used the javascript hack to insert the Device IDs into a new provisioning profile, with a new appID, re-downloaded it and re-imported it.

I have exactly the same error with exactly the same symptoms again, I just can't work out why the profile is clearly correct in Organiser but then doesn't seem to translate through to the profile screen.

Can anyone throw any insight my way please? :)

有帮助吗?

解决方案

Ahh the joys of codesign -- it has tripped up many developers trying to get build configuration setup. This too is a mismatch between a few different settings in Xcode and potentially your App Store Distribution Profile. There are three places that you have to make sure are set identically to ensure this error clears, each of which is tied to the AppID. I answered a similar question relating to a Development Certificate and Provisioning Profile, however the same set of checks is required for your App Store distribution certificates and provisioning profile:

A valid provisioning profile matching the application's identifier could not be found

That question includes some additional information about where particular settings are located, and the process by which one would go through to go from code to device build. A nearly identical process could be used to setup for App Store Distribution -- replace references from "Development Provisioning Profile" to "App Store Distribution" profile as well as omit those test device configurations that aren't applicable to Distribution builds and you should be good to go.

Should you rather try and debug using what you currently have, then read on:

At the core of code sign is the need for your AppIDs to match up in each of the documents issued by the 'Certificates, Identifiers, and Profiles' tool as well as in the build configuration of your Xcode project. There are a few ways in which you can solve the issue, either changing your provisioning profile and signing settings to match the same AppId, or changing the AppID to match your provisioning profiles. It is important to understand the ramifications of this decisions -- Unless you specifically need shared keychain access and specifically do not need any entitled services (In-App Purchase, Push Notifications, iCloud, Game Center, Newsstand, Data Protection, etc.) the option with the least restrictive results is to change your provisioning profile to match your current AppId.

Quickest (but most restrictive) route to a successful codesign build

Your description of the error certainly confirms the root problem -- You have a Distribution Profile named "Company Distribution" set to an AppID from the Certificates, Identifiers, and Profiles tool that is "Company.", however your App Specifies an AppID of "2Cxxxxx3D5.Company.App" which does not match the AppID that code sign is using. Put a different way, your project is configured to set the Bundle ID to "2Cxxxxx3D5.Company.App" while you are attempting to codesign a bundle "Company.". The "2Cxxxxx2D5." part violates the provisioning profile you (or perhaps the Xcode Automatic Profile Selector) has picked for your archive codesign operation.

The "2Cxxxxx3D5." part of your AppID looks suspiciously like an App ID Prefix -- this should not be specified in the Xcode App ID field (or in the Info.plist where that field's value is derived. Xcode automatically handles the App ID Prefix for you based on the Provisioning Provisioning Profile used to do code sign. If your Xcode App ID contains this prefix value remove it so that your App ID becomes "Company.App". In doing so, your Application's App ID becomes a valid App ID given the "Company.*" Distribution Provisioning profile that the error indicates is being used during code sign.

More sustainable fix -- Fix the AppID and Reissue the Distribution Provisioning Profile

As Apple continues to release 'entitlement' based services, it may not be agreeable to issue this app under the wildcard Provisioning Profile. Instead, the best way to retain the widest flexibility is to issue an explicit AppID for your Company's app, reconfigure Xcode, and reissue the Distribution Profile for that new explicit AppID. The linked answer above serves as a step-by-step guide for how to do each of these tasks except the Distribution Provisioning Profile. At a high level, the tasks to complete are:

  1. Update the App ID in the Xcode project to omit the TeamID / App ID Prefix.
  2. Ensure that the edited App ID is registered with Apple's Certificates, Identifiers, and Profiles tool.
  3. Issue a Distribution Provisioning profile for the new bare-bones App ID
  4. Install to Xcode, restart Xcode, then ensure that the Codesign Settings are using the new Provisioning Profile and Signing Identity.
  5. Run the Archive.

Once you get the App ID matched up to the one encoded in the Distribution Provisioning profile you should be in a much better state to run your Archive. If you run into additional questions or problem, tack a comment on to this answer and we can see what we can do.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top