The trickiest part of developing for the iPhone is probably signing your code s.t. it will install on a device and/or be accepted by the App Store. While there are harder (and more interesting) problems, this is the only one I’ve consistently seen referred to as “voodoo”. Here’s my story, which includes a couple of details I haven’t seen covered elsewhere.
Background
I was putting the finishing touches on an application – let’s call it application ‘A’. I had been working on this project for about a month, and had installed it on my iPhone many times. At one point, I decided to add a new feature to an older app (application ‘B’) that I had also previously installed on my iPhone. After adding my changes, and attempting to reinstall app. B on the device, I got the dreaded “Application Verification Failed” error message.
Troubleshooting
At this point, the app I was originally working on (‘A’), as well as a third app (application ‘C’) both continued to install correctly. I tried reverting my entire app. B project to an earlier (known good) SVN version, but the problem persisted.
After a lot a mucking about with restarts, new certs, and rebuilds, I did make some ‘progress’: I found that app. A wouldn’t install either. This made me a Sad Panda, as app. A was (1.) very close to completion and (2.) something I was planning to sell. At this point, app. C still installed successfully, which was, I suppose, something.
“Breakthrough”
After a lot more mucking about, I received a new, marginally less obscure error to the effect that “the device doesn’t have provisioning profile the application was signed with”. Aside from a quick exclamation that “yes it bloody well does”, the primary result of this error message was a Google search for some new error terms, and an examination of the “Code Signing Identity” parameter of the “Code Signing” section of the project settings (Project -> Edit Project Settings). I changed this drop-down to “iPhone Developer: Michael Heyeck” for the proper provisioning profile.
This produced the following changes in the .pbxproj file:
Index: taipan/taipan.xcodeproj/project.pbxproj
===================================================================
--- taipan/taipan.xcodeproj/project.pbxproj (revision 645)
+++ taipan/taipan.xcodeproj/project.pbxproj (working copy)
@@ -234,12 +234,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Michael Heyeck";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "2A069768-D90C-4038-A6F2-E107BCF05619";
SDKROOT = iphoneos2.2.1;
};
name = Debug;
And then app. B installed correctly on the device. Similar changes also fixed the app. A build process.
Unanswered Questions
Of course, if the code signing project settings were wrong, it’s pretty damn mysterious how Xcode had managed to install the apps on the iPhone for so long. And, if they were right, it’s pretty damn mysterious why they had to be changed. (It’s worth pointing out that I hadn’t performed any upgrades: One minute, the installation process worked, and the next, it didn’t.)
My Suggested Takeaways
While the lessons of this incident are a little on the obscure side, here are some things to think about:
- Code signing can go awry at any time; just because a certain configuration worked today doesn’t mean it will work tomorrow. Don’t get complacent, but don’t fret too much if this happens to you.
- This thread is a pretty good list of things to check when code signing goes Tango Uniform. (It didn’t cover my problem, though.)
- You might need to change your code signing project settings – I don’t recall this being covered in the Apple docs I read.
- You might check the raw data in your .pbxproj for the lines changed in the preceeding SVN diff, and see if they look right to you.