Today I was testing a new build of an iOS app and experienced what I think is a weird conflict with a previous version of the app. Here’s what happened:
I was testing a developer build of the app on an iPhone 3G running 3.1.2 and an iPhone 4 running 4.0.1. Before testing I installed an updated developer provisioning profile on each device. Everything worked perfectly on the 3G, but on the iPhone 4 the app would show the splash screen for a split second then close. It was as if the app was crashing on the iPhone 4 but there was no crash information showing up in the debugger. As far as the debugger was concerned there was nothing wrong to report.
I opened the Organizer window and checked the Device Logs tab for any crashes but there was nothing regarding the app I was testing. Next I checked the Console tab and saw the following:
Tue Sep 7 15:59:11 My-iPhone com.apple.launchd[1] (UIKitApplication:com.appname[0x2d1][6531]) : (UIKitApplication:com.appname[0x2d1]) posix_spawn(“/var/mobile/Applications/…/AppName.app/AppName”, …): Permission denied
Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Unable to obtain a task name port right for pid 6531: (os/kern) failure
Tue Sep 7 15:59:11 My-iPhone com.apple.launchd[1] (UIKitApplication:com.appname[0x2d1][6531]) : (UIKitApplication:com.appname[0x2d1]) Exited with exit code: 1
Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Unable to look up event port name for pid 6531: (os/kern) successful
Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Unable to send activation event to com.appname animate activate: safe animationStart = 406459.5189769584 deactivate: : (ipc/send) invalid destination port
Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Application ‘AppName’ exited abnormally with exit status 1
I Googled for explanations about the different warnings without success. Not knowing what else to do I decided to test the app one more time from a clean slate, so I deleted both the app and development profile from the iPhone 4. I tested again and to my surprise the app launched and worked flawlessly.
So what happened? An ad hoc build of a previous version of the app was already installed on the iPhone 4 and I did not delete it before testing a new developer build. Maybe Xcode 3.2.3 doesn’t completely remove a previous version of an application when testing a new version, and instead only updates relevant parts of the application’s bundle. If the bundle wasn’t updated correctly I suppose it could explain this weird behavior, though I really would have expected the app to be replaced completely or for an outright crash when i tried to run the app.
Anyway, if you are testing your app and you see similar behavior and an error message like the one above try deleting your app from the phone and then testing. Maybe it will work for you as well.