Xcode 4.3 crashes on Archive
The Situation
I have an Xcode project for an iOS app with 10 targets creating different variants of the app. I was able to archive all except one of the targets. On building an archive of this target Xcode crashed with
(NSInvalidArgumentException): -[DVTFilePath compare:]: unrecognized selector sent to instance 0x406368fe0
The build and linking worked properly and the activity viewer showed ‚Archive success‘ shortly.
In the good case after this step the Organizer opens and shows the generated archive. If there is an error during archive Xcode shows this in the standard issue navigator and in the activity viewer – but you know this. In my case Xcode crashed with the error mentioned above.
I had no problems earlier and was a little bit surprised as this error was 100% reproducible.
The Analysis
The typical first step is to look for someone else having the same problem. It showed out that there were some developers with the same problem. I stepped over Ash Furrows blog entry on this topic: growl notification code signing for sandboxed mac apps
Ash describes the same crash by using the Growl.framework in one of his projects in correlation with code signing. I did not use that framework in my project, but remembered that I included the Facebook iOS SDK. This one was built locally from the sources and the static library is inside my Xcode project. As the app does not use Facebook features currently the static library is not used in any target – it is just in the project. But in contrast to Ash’s problem with the Growl.framewok mine was a little bit different: I did not used a binary version of the static library, but it was already compiled on my own. So, what’s the problem?
The Solution
After removing the library from my project everything worked fine. So the crash must be related to the static library. I added it to the project again, but not to any target and boom – Xcode crashes. After that I found the helpful words in Ash’s blog entry: „You’ll need to rebuild Growl.framework any time your certificate expires, once a year.“
I remembered that I had to renew my certificate a few days ago. And indeed this is the solution! If you have another framework or static library in your Xcode project (even if not used!) you have to recompile that every time your developer certificate changes – usually once a year. If you miss that Xcode 4.3 ends up in a crash if you create an archive.
This is a really bad behavior of a piece of software to react with a crash on some kind of reconfiguration. Apple should fix this annoying and not even easy to handle bug. In the case of Ash and myself we were able to recompile the code as the sources are available to the public.