Unity iOS Build Fails with Code Signing Errors - How to Fix

Problem
Unity builds for iOS but the build fails with code signing errors. Common messages include "Code signing failed", "No valid signing identity", "Provisioning profile doesn't include the signing certificate", or "Unable to install app on device." The build may complete in Unity but fail in Xcode when archiving or installing.

Root Cause
iOS requires every app to be signed with a valid provisioning profile and signing certificate. Unity generates an Xcode project; Xcode then performs code signing. Failures usually come from:

  • Missing or wrong provisioning profile for the app's Bundle ID and team
  • Expired or revoked certificate (development or distribution)
  • Signing identity not installed on the Mac (certificate + private key)
  • Entitlements mismatch (e.g. push notifications, capabilities) between Unity/Xcode and the profile
  • Wrong team or Bundle ID in Unity Player Settings vs Apple Developer account
  • Xcode not set to automatic or correct manual signing for the Unity-generated project

This guide walks you through the most reliable fixes so your Unity iOS build signs correctly and runs on device or submits to App Store.


Quick Fix Summary

  1. Match Bundle ID in Unity (Player Settings β†’ iOS β†’ Bundle Identifier) to the App ID in your Apple Developer account.
  2. Create or download the right provisioning profile (Development for device testing, Distribution for App Store) and install it on your Mac.
  3. Install the signing certificate (development or distribution) in Keychain and ensure Xcode can see it.
  4. Open the Unity-generated Xcode project and set Signing & Capabilities to your team and profile (or Automatic).
  5. Align entitlements in Xcode with what the provisioning profile allows (e.g. push, in-app purchase).

Step-by-Step Fixes

Solution 1: Set Bundle ID and Team in Unity

When to use: First-time iOS build or after changing your app name/identifier.

  1. In Unity, go to Edit β†’ Project Settings β†’ Player, select the iOS tab.
  2. Under Other Settings, set Bundle Identifier to match your App ID in Apple Developer (e.g. com.yourstudio.yourapp). It must be exact.
  3. Under iOS (or Publish Settings), set Apple Developer Team ID if your project uses it (optional in some Unity versions; Xcode can override).
  4. Build to Xcode (File β†’ Build Settings β†’ iOS β†’ Build). Do not change the Bundle ID in Xcode unless you also change it in Unity and regenerate the Xcode project.

Verification: After building, open the Xcode project and check Signing & Capabilities. The Bundle Identifier should match Unity. If it does not, fix it in Unity and rebuild.

Pro tip: Use one Bundle ID for development (e.g. com.yourstudio.yourapp) and do not change it between builds unless you create a new App ID and profile.

Solution 2: Create and Install a Provisioning Profile

When to use: "No valid provisioning profile" or "Provisioning profile doesn't include the signing certificate."

  1. In Apple Developer Portal, create an App ID (if needed) matching your Bundle ID.
  2. Create a Development provisioning profile (for device testing) or Distribution (for App Store/TestFlight). Attach the correct certificate and select the App ID and devices (Development) or App Store distribution.
  3. Download the profile and double-click to install it (or drag into Xcode).
  4. In Xcode, open the Unity-generated project, select the Unity-iPhone target, go to Signing & Capabilities.
  5. Select your Team and choose Automatically manage signing (recommended) or Manual and pick the profile you installed.

Verification: Xcode shows no signing errors in the issue navigator. Archive (Product β†’ Archive) or run on device (Product β†’ Run). If it still fails, the certificate may be missing or wrong (see Solution 3).

Common mistake: Using a Distribution profile when you want to run on a connected device. Use a Development profile and add the device UDID to the profile (and regenerate if needed).

Solution 3: Install the Signing Certificate

When to use: "No valid signing identity" or "Certificate not found."

  1. In Apple Developer, create a Development or Distribution certificate if you do not have one. Download it and double-click to add to Keychain Access.
  2. Ensure the private key is present: In Keychain Access, find the certificate; it should have a small triangle next to it. Expand it and confirm the private key is there. If the key is missing (e.g. you moved Macs), you must create a new certificate and revoke the old one.
  3. In Xcode, go to Xcode β†’ Settings β†’ Accounts, select your Apple ID, click Manage Certificates. You should see your development/distribution certificate. If not, create one from Xcode or download from the portal and install.
  4. Back in the Unity-generated project, Signing & Capabilities should now show your team and allow profile selection. Choose the profile that uses this certificate.

Verification: Product β†’ Archive succeeds, or Product β†’ Run installs on device without "code signing failed."

Pro tip: On a new Mac, you must install both the certificate (from the portal or from the machine that created it) and have the private key. If you lost the private key, revoke the certificate in the portal and create a new one.

Solution 4: Fix Entitlements and Capabilities

When to use: Error mentions "entitlements" or a specific capability (e.g. push notifications, in-app purchase).

  1. In Unity Player Settings β†’ iOS, under Publish Settings (or Other), only enable capabilities you actually use (e.g. Push Notifications, In-App Purchase). Unity may generate an entitlements file.
  2. In Xcode, select the target β†’ Signing & Capabilities. Add only the capabilities that your provisioning profile supports. If the profile was created without push, do not add Push Notifications in Xcode unless you regenerate the profile with that capability.
  3. If Unity generated an entitlements file (e.g. Unity-iPhone.entitlements), open it and ensure it matches what you have in Signing & Capabilities. Remove any capability that is not in your App ID or profile.

Verification: Archive or run on device. Entitlement-related errors should be gone.

Common mistake: Adding a capability in Xcode that is not in the App ID or provisioning profile. Always add the capability in the Apple Developer portal (App ID β†’ Edit β†’ enable capability), then regenerate the provisioning profile, then add in Xcode.

Solution 5: Use Automatic Signing in Xcode (Recommended)

When to use: You want Xcode to manage profiles and certificates for you.

  1. Open the Unity-generated Xcode project.
  2. Select the Unity-iPhone target β†’ Signing & Capabilities.
  3. Check Automatically manage signing.
  4. Select your Team. Xcode will create or select a matching profile and use your installed certificate.
  5. If you see "Failed to register bundle identifier," the Bundle ID may already be in use by another team or app. Use a unique Bundle ID (e.g. add a suffix for development).

Verification: Product β†’ Run on device or Product β†’ Archive. No manual profile/certificate selection needed.

Pro tip: Automatic signing works well for development and small teams. For complex setups (multiple apps, CI/CD), manual signing with explicit profiles is often easier to reproduce.


Verification Checklist

After applying fixes:

  1. Unity: Bundle ID and (if used) Team ID match Apple Developer.
  2. Xcode: Signing & Capabilities shows your team and no red errors.
  3. Keychain: Certificate and private key are present; no "This certificate has an invalid issuer."
  4. Device: For development, device UDID is in the provisioning profile and the profile is installed.
  5. Archive: Product β†’ Archive succeeds; Organizer shows the archive and allows Distribute App.

If any step fails, the error message in Xcode (Issue navigator or Report navigator) usually points to the missing piece (profile, certificate, or entitlement).


Prevention Tips

  • Keep certificates and profiles in sync: When you regenerate a profile (e.g. after adding a device), download and install it again. Remove old profiles in Xcode (Settings β†’ Accounts β†’ Manage Certificates / Download Manual Profiles) to avoid Xcode picking the wrong one.
  • Use one Bundle ID per app: Do not change it between builds unless you intentionally create a new app. Changing it forces new profiles and can break existing installs.
  • Document your setup: Note which profile and certificate you use for development vs distribution. New team members or new Macs need the same certificates (or new ones created and profiles regenerated).
  • Update before major Unity/Xcode upgrades: New Xcode or Unity versions can change how the project is generated. Re-check Signing & Capabilities after upgrading.

Related Problems and Links

Bookmark this fix for quick reference when you hit code signing again. If you are still stuck, check the exact error in Xcode’s Report navigator and match it to the solution above (profile, certificate, or entitlements). Share this article with your dev friends if it helped.