Search code examples
iosxcodexcodebuildcodesignbitrise

Bitrise is trying to code sign an embedded framework with wrong provisioning profile


My iOS project has an embedded framework. I am trying to build it on Bitrise, but it fails because it tries to code sign this framework with the same provisioning profile as the actual project.

This is the error it produces (split onto separate lines for readability):

❌  Code Sign error: Provisioning profile does not match bundle identifier: 
The provisioning profile specified in your build settings 
(“Profile Name”) has an AppID of “com.example.mainidentity” 
which does not match your bundle identifier 
“com.example.frameworkidentity”.

I've tried it with Force code signing with Provisioning Profile, with Force code signing with Identity, without either and various other permutations. Changing the Code Signing Identity from iOS Developer to Don't Code Sign in the framework's Build Settings. Etc.

I've left Code Sign on Copy on in the Build Phases of the main project.

Nothing seems to work.

It's my understanding that an embedded framework should just sign with the iOS Developer identity as you archive a project.

-

The project archive's fine on my local machine.

Environment & info:

Using a workspace, the embedded framework does have it's own pods, as does the main project.

I'm using Xcode 7.3 on OS X 10.11.6

The provisioning profile is an iOS UniversalDistribution type one.

The Bitrise workflow is using:

  • Certificate and profile installer - 1.7.0

  • Xcode: Create Archive - 1.9.2

If any other info is needed or anything needs clarifying let me know!

Thank you!!


Solution

  • You should not use "Force code signing with Provisioning Profile" in this case, as that (this is simply an option passed to Xcode) will force that specific profile to be used for every part of the project!

    You can find more information here: https://bitrise-io.github.io/devcenter/ios/code-signing/#full-manual-full-control

    TL;DR; don't use a full Provisioning Profile ID, rather use "Force Identity" if you really have to (and maybe just a category for Force Prov Profile, like "iPhone Distribution"), Xcode will figure out which profile to use, based on the Identity and bundle IDs etc.

    That said, since Xcode 7 the recommended way is to use "Export Options Plist", and in Xcode 8 if you opt-in for automatic code signing that's your only option. In short, the recommended way is to do an initial signing with development code signing, and then specify the "export method" for Xcode (in case of Bitrise this is an option of the Xcode Archive step). The only this to note here is that you need both development and distribution certs & profiles to be available. But once you do, selecting the right one for distribution is as easy as setting the "export method" option (Xcode Archive step) to the type you want to use (e.g. ad-hoc or app-store).

    More info: https://bitrise-io.github.io/devcenter/ios/code-signing/#using-export-options-available-for-xcode-7-and-xcode-archive-step-v191

    P.S.: if you'd want to migrate to the new code signing options you should reset the inputs you previously specified - probably the fastest way, if you use the Web UI, is to remove the Xcode Archive step, and then add a new one to the same spot.