Fix: CodeSign Error – Code Signing Is Required for Product Type Application in Xcode

Written by

in

Quick answer: The error occurs when Xcode cannot match a valid signing identity to the target’s build settings. Fix it by selecting your developer profile under “Any iOS SDK” (not Debug/Release) in the Code Signing Identity build setting, then refresh provisioning profiles in Xcode Settings > Accounts.

Why this happens

Xcode requires a valid code signing identity for any build that runs on a physical device. The error “CodeSign error: code signing is required for product type ‘Application’ in SDK ‘Device – iOS X.Y’” appears when the build settings do not resolve to a concrete signing certificate for the active SDK.

Common causes:

  • The Code Signing Identity build setting is set at the configuration level (Debug, Release) instead of the SDK-specific level (“Any iOS SDK”), so Xcode ignores it for device builds.
  • Provisioning profiles in Xcode’s account cache are stale, expired, or missing the device’s UDID.
  • The target’s Signing & Capabilities pane shows “Signing Certificate: Sign to Run Locally” or a missing profile because automatic signing cannot find a matching profile.

How to fix it

1. Set the signing identity at the SDK level (most reliable fix)

  1. Select the project in the navigator, then the target.
  2. Open Build Settings and search for Code Signing Identity.
  3. Expand the setting. You will see rows for Debug, Release, and Any iOS SDK.
  4. Set Any iOS SDK → iPhone Developer (or your specific “Apple Development” certificate).
  5. Leave Debug and Release as “Don’t Code Sign” or inherit from the SDK row.
  6. Do the same for Code Signing Identity – Release if you distribute Ad Hoc or App Store builds.

Why this works: Xcode evaluates the “Any iOS SDK” row when building for a device. Configuration-level rows are only used for simulator builds.

2. Refresh provisioning profiles in Xcode Settings

  1. Open Xcode > Settings > Accounts.
  2. Select your Apple ID / team, click Manage Certificates.
  3. Remove any expired or duplicate certificates.
  4. Click the + button → Apple Development to request a fresh certificate.
  5. Back in the Accounts pane, click Download Manual Profiles (or enable Automatically manage signing on the target and toggle it off/on).

3. Clean derived data and rebuild

# Optional: clean via terminal if UI clean doesn't help
rm -rf ~/Library/Developer/Xcode/DerivedData

Then Product > Clean Build Folder (⇧⌘K) and build again.

4. Verify the device is in the provisioning profile

  • In Settings > Accounts > Manage Certificates, double-click the profile → Devices.
  • Confirm the test device’s UDID is listed. If not, add it in the Apple Developer portal, regenerate the profile, and re-download.

How to prevent it

  • Keep Automatically manage signing enabled for debug builds; only switch to manual for distribution.
  • Periodically run Xcode > Settings > Accounts > Download Manual Profiles after adding devices or renewing certificates.
  • Store certificates in the login keychain (not System) so Xcode can access them without extra permissions.
  • Use xcconfig files to share signing settings across targets and avoid per-target drift.

FAQ

Why does the error mention an old iOS SDK like “Device – iOS 4.1”?

The message template includes the active SDK name. On modern Xcode it will show “Device – iOS 18.x” or similar. The fix is identical regardless of the SDK version shown.

Can I just set “Don’t Code Sign” for Debug to avoid the error?

Only for simulator builds. Device builds must be code signed; “Don’t Code Sign” at the Any iOS SDK row will always produce this error.

What if automatic signing says “No profiles for ‘com.example.app’ were found”?

Ensure the bundle identifier is registered in the Apple Developer portal (Certificates, Identifiers & Profiles → Identifiers). Then toggle Automatically manage signing off and on to force Xcode to create/download a matching profile.`,

Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.