codesign IPA and the code object is not signed at all problem

You know this journey starts with, “…I was so excited to get Mountain Lion and download the new Xcode.” I’m now absolutely shocked as for the first time, I’m faced with a strange and unique predicament. I cannot archive one of my commonly archived for Ad Hoc developer release iOS applications. What happened? Where did it start breaking? I’ll share the facts here and maybe, just maybe, this might help out some poor soul out there.

Let’s start by saying this, how do you even know you’re having this issue? The first sign of trouble is you build an archive file in Xcode for an “Ad Hoc” release. The last step finishes up with a code signing or “codesign” process and a final saving of the IPA file. Everything seems to work properly. You then do one of the following, install via iTunes or upload the IPA to Test Flight. All seems fine and grand. The trouble has just begun. Your users will begin reporting to you that they cannot download or worse they are seeing the “Failed to install” error. You’re already in this hole now… what is going on?

My first gut reaction was to start building another archive and then another and each one had the same issue. I finally realized that the Xcode Organizer tool was going to help me out. I did the install using iTunes on my iPad 3 and monitored the iPad 3 console in Organizer.

I can’t tell you how upsetting it was to see this error and to know that Xcode when archiving did not even make a peep about a code signing error. I quickly opened up my friendly terminal and located my IPA file that I had just attempted to install. I ran the famous command “codesign” and here is what it looks like.

Chris-Danielsons-MacBook-Pro-2:Desktop myUserAcct$ codesign -dvvv MySpecialApp.app
MySpecialApp.app: code object is not signed at all

So it’s clear to me that Apple has a fairly major issue on their hands that has seemingly let the user wander mindlessly into a trap thinking they were on a great journey of sorts.

So here is the question, how does one correct this issue? Continuing to fail miserably… here is what I have done thus far to attempt to correct the issue.

I have verified that all my certificates are in order. Deleted my mobile provisioning profiles manually, re-added them from the Apple developer portal.

Open Disk Utility and do a full verify and repair disk permissions.

Do a full shutdown and startup of my computer.

None of these processes have fixed this issue.

I finally figured out the solution by trial and error. In my case I had a folder name that matched the “Product Name” variable under build settings. This also matched the entire project name! So I simply changed one field. I changed the “Build Settings” -> “Product Name” . The value of MySpecialApp was changed to My-SpecialApp. That was simply it! I then logged back into the Apple developer portal and created a new App ID and mobile provisioning profiles for development and distribution and the rest is history. My releases now work when deployed via the Ad Hoc distribution.

A final note on this. This is definitely a bug that Apple should either alert the user that they have done something wrong and enable some sort of automated corrective action. After archiving I still receive:

codesign -dvvv My-SpecialApp.ipa
My-SpecialApp.ipa: code object is not signed at all

So what gives? Something is very wrong here, but this solution works for now.

the exactly same error popped up on my device after upgrading my build machine to Mountain Lion and XCode 4.5.

The builds were still signed, but when I deployed them to the device via iTunes, the installation fails and the errors appeared in the devices console.

After three days of searching I finally managed to have a working build again. I’m not definitely sure what the cause was, but it seems to me, that it has something to do with having the distribution profile accidently in two keychains, the “login” one and one that is called as my username.

After removing the profile from the my-username-keychain and switching from script-driven build (via command line tools) to building via the frontend, it suddenly works again.

About Me

I'm a software developer focused on all facets of enterprise solutions and technologies. Currently I code Scala, Java, Swift, Objective-C, .Net, to name a few. My latest endeavor is LogVine. We're soon moving from micro-log to a new sustainable living framework and feature set.