Home - Archive - Snipposé - Rename Finder Items

Xcode Build Signing Issues with Duplicated Targets

One of the benefits of automating builds is that it will surface a lot of quirks in your build settings, schemes and targets that you may not have realized were there.

While setting up a Jenkins job to build and sign an iOS app recently I ran into an extremely frustrating code signing error that turned out to be caused by multiple targets with the same executable name.

Why would you have two targets that produce the "same" executable product? In this case, it had to do with code signing. One target used a bundle id for an internal development team and the other, which was a copy of the original target, used a bundle id for an external client.

What made it difficult was that the signing identifies and provisioning profiles were all present both locally and on the build server and looked to be correct in the build settings. However signing the app on the build server would fail every time with a cryptic error about a signing identity not found. The build would run just fine locally.

Long story short, the problem turned out to be buried in the scheme settings.

Fixing the Error

If you open the scheme editor, you'll see options for Build, Run, Test, Profile, Analyze and Archive. Of these, Build and Test will list a set of targets with checkboxes and Run and Profile have a dropdown to select an executable.

Generally you want the Build tab options to list a single executable target. If you see both your original and your copied target listed, there's a problem.

Go through each tab and make sure that the only the correct target is referrenced and it should clear up the problem.

Did for us.