Code signing points in Xcode 14 and repair them


Written by Rudrank Riyam

For the reason that launch of Xcode 14, quite a few code signing points have emerged, plaguing builds throughout numerous CI/CD platforms. And regardless that code signing course of was by no means straightforward, points like these had been comparatively unusual in earlier variations of Xcode, akin to Xcode 13 and Xcode 12, leaving many builders anxious.

If you’re dealing with some unfamiliar code signing points with Xcode 14, whereas all the pieces appears to be effective along with your keys and certificates, you aren’t alone. Luckily, builders have already give you workarounds for a few of these errors. This text discusses recurring code signing issues associated to Xcode 14, Swift Package deal Supervisor, and CocoaPods, in addition to just a few potential options and workarounds.

These code signing points may be encountered in several situations and contexts, so we’ll undergo a number of of them:

  1. Swift Package deal Supervisor code signing points
  2. CocoaPods code signing points
  3. Conflicting provisioning profiles points

Let’s get began!

If you happen to’re new to iOS code signing, learn this information.

Swift Package deal Supervisor code signing points

The primary dependency supervisor wherein this code signing downside happens is the Swift Package deal Supervisor. It really works effective for Xcode 13 for those who run it through a CLI, however operating the identical archive xcodebuild command on Xcode 14 throws an error much like this:

spm-bundle-sign-package_TargetWithResources requires a growth workforce. Choose a growth workforce within the Signing & Capabilities editor.

These errors might come from packages or native packages which have a sources bundle. Xcode 14 tries to code signal useful resource package deal bundles, however this isn’t supported.

An answer advised by an Apple engineer is to move CODE_SIGN_STYLE=Guide as an argument when constructing the IPA.

So, in case you are utilizing Codemagic, move the arguments as xcargs within the xcode-project build-ipa command:

xcode-project build-ipa --project "$XCODE_PROJECT" --scheme "$XCODE_SCHEME --archive-xcargs "CODE_SIGN_STYLE=Guide DEVELOPMENT_TEAM=<YOUR_DEVELOPMENT_TEAM>"

If you happen to’re utilizing fastlane, you then might be able to remedy the problem by including xcargs "CODE_SIGN_STYLE=Guide" to Gymfile.

CocoaPods code signing problem

Xcode 13 used to mechanically set CODE_SIGNING_ALLOWED to NO by default for useful resource bundles. However that’s now not the case in Xcode 14. Sadly, that you must assign a growth workforce to each Pod goal.

In your Podfile, you possibly can add the next:

post_install do |installer|
  installer.pods_project.targets.every do |goal|
    if goal.respond_to?(:product_type) and goal.product_type == "com.apple.product-type.bundle"
      goal.build_configurations.every do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      finish
    finish
  finish
finish

Nonetheless, it’s a must to be cautious in regards to the above workaround, as there could also be an invalid signature error, which can trigger your app to be rejected. Right here’s a pattern error that you could be obtain from App Retailer assessment, the place it complains in regards to the mistaken kind of code signing certificates:

ITMS-90035: Invalid Signature
- The binary with bundle identifier 'SOME_IDENTIFIER' at path [SOME_APP.app] accommodates an invalid signature. Be sure you have
signed your utility with a distribution certificates, not an advert hoc certificates or a growth
certificates. Confirm that the code signing settings in Xcode are right on the goal degree (which override
any values on the undertaking degree). If you're sure your code signing settings are right, select 'Clear
All' in Xcode, delete the 'construct' listing within the Finder, and rebuild your launch goal.

Nonetheless, some builders have reported efficiently passing App Retailer assessment whatever the problem.

One other different is to set the event ID for every Pod goal:

post_install do |installer|
  installer.generated_projects.every do |undertaking|
    undertaking.targets.every do |goal|
        goal.build_configurations.every do |config|
            config.build_settings["DEVELOPMENT_TEAM"] = "Your Workforce ID"
         finish
    finish
  finish
finish

These workarounds ought to show you how to get your undertaking code signed and dealing on Codemagic for Xcode 14.

Tell us on Twitter if the answer offered above solves your downside!

Flutter 3.3.3 fixes

In Flutter 3.3.3 and above, you wouldn’t have to manually add the above settings to get CocoaPods to work. The brand new model doesn’t code signal transitive dependencies, and you could find the pull request that fastened it right here.

If you’re utilizing Flutter 3.3.3 and above, it’s possible you’ll take away any construct setting workarounds you’ve gotten added to your Podfile.

Conflicting provisioning profiles points

One other problem arising with the discharge of Xcode 14 has to do with the conflicting provisioning profiles. This downside is plaguing tasks utilizing each Swift Package deal Supervisor and CocoaPods. The error seems to be one thing like this:

spm-bundle-sign-package_TargetWithResources has conflicting provisioning settings. spm-bundle-sign-package_TargetWithResources is mechanically signed for growth, however an inconsistent code signing identification Apple Distribution has been manually specified. Set the code signing identification worth to "Apple Improvement" within the construct settings editor, or change to guide signing within the Signing & Capabilities editor.

A possible repair for this problem is including one other flag to the xcode-project build-ipa command:

xcode-project build-ipa --project "$XCODE_PROJECT" --scheme "$XCODE_SCHEME --archive-xcargs "CODE_SIGN_STYLE=Guide DEVELOPMENT_TEAM=<YOUR_DEVELOPMENT_TEAM>"" --archive-flags "-destination 'generic/platform=iOS' CODE_SIGNING_REQUIRED=YES CODE_SIGNING_ALLOWED=NO"

This works with each Swift Package deal Supervisor and CocoaPods tasks. If you happen to’re engaged on a CocoaPods undertaking, you need to run pod set up earlier than establishing signing utilizing xcode-project use-profiles for those who’re not doing so already.

Conclusion

Code signing is tough to work with, and these new points complicate issues much more. However don’t fear! Codemagic has received you lined with the options offered above and by making code signing as seamless as doable with code signing identities and computerized code signing. Now you can mechanically fetch code signing certificates from Apple Developer Portal in addition to add code signing certificates and provisioning profiles to make use of them for a number of apps. With all that, you possibly can redirect your efforts to offering a greater expertise in your customers as a substitute!

Our workforce is raring to learn about your expertise whereas fixing this problem. In case you have any ideas or suggestions, be part of our Slack neighborhood!



Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles